Development

載入檢查點時出現分段錯誤 - altcoin dev

  • April 7, 2018

我試圖複製比特幣的原始碼並執行一個全新的區塊鏈。我成功地改變了初始參數,例如

  • psz時間戳
  • 時間
  • nNounce

生成了一個創世塊並替換了硬編碼的值

  • 共識.hashGenesisBlock
  • genesis.hashMerkleRoot

以上步驟成功生成了創世塊。但之後比特幣核心試圖從磁碟載入檢查點(我認為是這樣)並導致錯誤。

2017-07-31 21:06:42 Bitcoin version v0.14.99.0-42307c4bf-dirty
2017-07-31 21:06:42 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2017-07-31 21:06:42 Assuming ancestors of block 0000000000000000003b9ce759c2a087d52abc4266f8f4ebd6d768b89defa50a have valid signatures.
2017-07-31 21:06:42 Using the 'standard' SHA256 implementation
2017-07-31 21:06:42 Using RdRand as an additional entropy source
2017-07-31 21:06:42 Default data directory /Users/username/Library/Application Support/Bitcoin
2017-07-31 21:06:42 Using data directory /Users/username/Library/Application Support/Bitcoin
2017-07-31 21:06:42 Using config file /Users/username/Library/Application Support/Bitcoin/bitcoin.conf
2017-07-31 21:06:42 Using at most 125 automatic connections (4864 file descriptors available)
2017-07-31 21:06:42 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2017-07-31 21:06:42 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2017-07-31 21:06:42 Using 2 threads for script verification
2017-07-31 21:06:42 scheduler thread start
2017-07-31 21:06:42 HTTP: creating work queue of depth 16
2017-07-31 21:06:42 No rpcpassword set - using random cookie authentication
2017-07-31 21:06:42 Generated RPC authentication cookie /Users/username/Library/Application Support/Bitcoin/.cookie
2017-07-31 21:06:42 HTTP: starting 4 worker threads
2017-07-31 21:06:42 init message: Verifying wallet(s)...
2017-07-31 21:06:42 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2017-07-31 21:06:42 Using wallet wallet.dat
2017-07-31 21:06:42 CDBEnv::Open: LogDir=/Users/username/Library/Application Support/Bitcoin/database ErrorFile=/Users/username/Library/Application Support/Bitcoin/db.log
2017-07-31 21:06:42 Cache configuration:
2017-07-31 21:06:42 * Using 2.0MiB for block index database
2017-07-31 21:06:42 * Using 8.0MiB for chain state database
2017-07-31 21:06:42 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2017-07-31 21:06:42 init message: Loading block index...
2017-07-31 21:06:42 Opening LevelDB in /Users/username/Library/Application Support/Bitcoin/blocks/index
2017-07-31 21:06:42 Opened LevelDB successfully
2017-07-31 21:06:42 Using obfuscation key for /Users/username/Library/Application Support/Bitcoin/blocks/index: 0000000000000000
2017-07-31 21:06:42 Opening LevelDB in /Users/username/Library/Application Support/Bitcoin/chainstate
2017-07-31 21:06:42 Opened LevelDB successfully
2017-07-31 21:06:42 Using obfuscation key for /Users/username/Library/Application Support/Bitcoin/chainstate: 7bbd099730c6ddd0
2017-07-31 21:06:42 LoadBlockIndexDB: last block file = 0
2017-07-31 21:06:42 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2017-07-31 21:06:42 Checking all blk files are present...
2017-07-31 21:06:42 LoadBlockIndexDB: transaction index disabled
2017-07-31 21:06:42 Initializing databases...
2017-07-31 21:06:42 Pre-allocating up to position 0x1000000 in blk00000.dat
2017-07-31 21:06:42 init message: Verifying blocks...
2017-07-31 21:06:42  block index             208ms
2017-07-31 21:06:42 init message: Loading wallet...
2017-07-31 21:06:42 nFileVersion = 149900
2017-07-31 21:06:42 Keys: 2001 plaintext, 0 encrypted, 2001 w/ metadata, 2001 total
2017-07-31 21:06:42  wallet                  127ms
2017-07-31 21:06:42 setKeyPool.size() = 1999
2017-07-31 21:06:42 mapWallet.size() = 0
2017-07-31 21:06:42 mapAddressBook.size() = 1
2017-07-31 21:06:42 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
2017-07-31 21:06:42 *** Failed to read block
2017-07-31 21:06:42 Error: Error: A fatal internal error occurred, see debug.log for details

有一個執行緒解釋瞭如何阻止程式碼檢查檢查點。<https://bitcointalk.org/index.php?topic=225690.0>但是執行緒已經過時並且程式碼經歷了很多變化。

我需要一些幫助來解決錯誤並繼續安裝前幾個塊並將它們也硬編碼到程式碼中。

嘗試刪除塊文件。該錯誤表明已載入塊上的工作證明不正確。

還要檢查檢查點,也許這會有所幫助!

引用自:https://bitcoin.stackexchange.com/questions/57415