ビットコイン・インスティテュート

サトシから​ハル・フィニーへ​:serialize.hの​コード修正​(2009-01-24)

コードを重複させるのは嫌だが、コンパイラーの都合でそうするしかない。上の関数の中身をコピーして、次のようにする。

  void insert(iterator it, const_iterator first, const_iterator last)
  {
    if (it == vch.begin() + nReadPos && last - first <= nReadPos)
    {
       // special case for inserting at the front when there's room
        nReadPos -= (last - first);
       memcpy(&vch[nReadPos], &first[0], last - first);
    }
    else
       vch.insert(it, first, last);
  }

#if !defined(_MSC_VER) || _MSC_VER >= 1300
   void insert(iterator it, const char* first, const char* last)
   {
     if (it == vch.begin() + nReadPos && last - first <= nReadPos)
     {
        // special case for inserting at the front when there's room
         nReadPos -= (last - first);
        memcpy(&vch[nReadPos], &first[0], last - first);
     }
     else
        vch.insert(it, first, last);
   }
#endif

serialize.hを修正したファイルを添付した。

ところで、私の環境でVC8を試すと、VC8が入っているシステムでしか動かないEXEになった。表示されるエラーはひどく分かりにくい。セットアップ時にパッケージをインストールする想定なのだろうが、Bitcoinにはセットアップがない。

私がテストに使ったのはMSVC 6.0 SP6とGCC 3.4.5だ。リリース版はGCCでビルドしている。MSVC 6.0のビルドにも問題はないが、ブロックの生成に使うSHAのルーチンが、最適化しても遅い。

サトシ

原典の外部ソース

https://online.wsj.com/public/resources/documents/finneynakamotoemails.pdf
ウォール・ストリート・ジャーナルが公開したPDFから書き起こした。ハル・フィニーが2014年春に同紙へ渡したメール。件名は「Re: disk full」。PDFのヘッダーはSat, Jan 24, 2009 at 4:47 PM。タイムゾーンの記載がないため、太平洋標準時(UTC−8)としてUTCに換算した。PDFの行の折り返しはつなぎ直した。本文で触れている添付ファイルは残っていない。

他の外部ソース