回复:Bitcoind

中本聪SN-10156

我把它放在 bitcoin.org/download/linux64-0.2.7.1.tar.gz。你拿到后可以删掉。

I put it at bitcoin.org/download/linux64-0.2.7.1.tar.gz. You can delete it when you've got it.

我考虑了什么可能导致你遇到的问题,并作了一处修改,包含在这个构建中。这段代码可能不安全,尽管大概总能侥幸运行。

I thought about what might cause the problem you're having and made a change that this build includes. This might have been unsafe code, although it would probably always get lucky.

util.cpp 中的旧代码:

in util.cpp, old:

const char* wxGetTranslation(const char* pszEnglish)
{
     // Wrapper of wxGetTranslation returning the same const char* type
     // as was passed in
     static CCriticalSection cs;
     CRITICAL_BLOCK(cs)
     {
         // Look in cache
         static map<string, char*> mapCache;
         map<string, char*>::iterator mi = mapCache.find(pszEnglish);
         if (mi != mapCache.end())
             return (*mi).second;

         // wxWidgets translation
         const char* pszTranslated =
             wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8_str();

         // We don't cache unknown strings because caller might be
         // passing in a dynamic string and we would keep allocating
         // memory for each variation.
         if (strcmp(pszEnglish, pszTranslated) == 0)
             return pszEnglish;

         // Add to cache, memory doesn't need to be freed.  We only
         // cache because we must pass back a pointer to permanently
         // allocated memory.
         char* pszCached = new char[strlen(pszTranslated)+1];
         strcpy(pszCached, pszTranslated);
         mapCache[pszEnglish] = pszCached;
         return pszCached;
     }
     return NULL;
}
const char* wxGetTranslation(const char* pszEnglish)
{
     // Wrapper of wxGetTranslation returning the same const char* type
     // as was passed in
     static CCriticalSection cs;
     CRITICAL_BLOCK(cs)
     {
         // Look in cache
         static map<string, char*> mapCache;
         map<string, char*>::iterator mi = mapCache.find(pszEnglish);
         if (mi != mapCache.end())
             return (*mi).second;

         // wxWidgets translation
         const char* pszTranslated =
             wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8_str();

         // We don't cache unknown strings because caller might be
         // passing in a dynamic string and we would keep allocating
         // memory for each variation.
         if (strcmp(pszEnglish, pszTranslated) == 0)
             return pszEnglish;

         // Add to cache, memory doesn't need to be freed.  We only
         // cache because we must pass back a pointer to permanently
         // allocated memory.
         char* pszCached = new char[strlen(pszTranslated)+1];
         strcpy(pszCached, pszTranslated);
         mapCache[pszEnglish] = pszCached;
         return pszCached;
     }
     return NULL;
}

新代码:

new:

const char* wxGetTranslation(const char* pszEnglish)
{
     // Wrapper of wxGetTranslation returning the same const char* type
     // as was passed in
     static CCriticalSection cs;
     CRITICAL_BLOCK(cs)
     {
         // Look in cache
         static map<string, char*> mapCache;
         map<string, char*>::iterator mi = mapCache.find(pszEnglish);
         if (mi != mapCache.end())
             return (*mi).second;

         // wxWidgets translation
         wxString strTranslated = wxGetTranslation(wxString(pszEnglish,
             wxConvUTF8));

         // We don't cache unknown strings because caller might be
         // passing in a dynamic string and we would keep allocating
         // memory for each variation.
         if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
             return pszEnglish;

         // Add to cache, memory doesn't need to be freed.  We only
         // cache because we must pass back a pointer to permanently
         // allocated memory.
         char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
         strcpy(pszCached, strTranslated.utf8_str());
         mapCache[pszEnglish] = pszCached;
         return pszCached;
     }
     return NULL;
}
const char* wxGetTranslation(const char* pszEnglish)
{
     // Wrapper of wxGetTranslation returning the same const char* type
     // as was passed in
     static CCriticalSection cs;
     CRITICAL_BLOCK(cs)
     {
         // Look in cache
         static map<string, char*> mapCache;
         map<string, char*>::iterator mi = mapCache.find(pszEnglish);
         if (mi != mapCache.end())
             return (*mi).second;

         // wxWidgets translation
         wxString strTranslated = wxGetTranslation(wxString(pszEnglish,
             wxConvUTF8));

         // We don't cache unknown strings because caller might be
         // passing in a dynamic string and we would keep allocating
         // memory for each variation.
         if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
             return pszEnglish;

         // Add to cache, memory doesn't need to be freed.  We only
         // cache because we must pass back a pointer to permanently
         // allocated memory.
         char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
         strcpy(pszCached, strTranslated.utf8_str());
         mapCache[pszEnglish] = pszCached;
         return pszCached;
     }
     return NULL;
}

如果你仍然怀疑这段代码,测试时可以把它改为:

If you still suspect this code, for testing you could change it to:

const char* wxGetTranslation(const char* pszEnglish)
{
     return pszEnglish;
}
const char* wxGetTranslation(const char* pszEnglish)
{
     return pszEnglish;
}
引用 Martti Malmi 的文字Martti Malmi来源 ↗

我试着用 ddd 调试器调试自己构建的 bitcoind,但还没怎么成功。它总是占用系统的全部内存,最后崩溃。能请你再发我一次最新的 64 位 bitcoind 构建吗?这样我就能看看,问题是否出在我自己的构建。

I tried debugging my build of bitcoind with ddd debugger, but didn't have much success yet. It always ends up taking all the system's memory and finally crashes. Could you please send me again the latest 64 bit build of bitcoind, so I can see if the problem is about my build?

译文校对、修订与纠错

当前版本尚未建立逐条校对状态记录。来源核验、历史审校与当前译文校对是不同事项。

查看历史审校与代表修订 →

译文内容版本:e289d16565a6。用于比对文本,不代表校对等级或更新时间。

准备纠错说明

请填写对应原文、现译文、建议译法和理由。复制后通过你联系本站作者的渠道提交;此处不会自动发送。

来源
英文原标题

Re: Bitcoind

Martti Malmi 通信 · 收件人公开存档 ↗ 下载英文正文 COPA v. Wright Trial Exhibits ↗ 原始通信编号 #174 · 阅读完整往来 ↗ 记录编号 SN-10156

阅读字号

选择适合你的字号,之后阅读会继续使用。