diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-08-19 00:33:01 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-10-20 23:08:57 +0200 |
commit | 857c61df0b71c8a0482b1bf8fc55849f8ad831b8 (patch) | |
tree | e404a80e1070d495b18fe81c70378cf2a5ee60c7 /src/db.cpp | |
parent | 4fea06db25108e7f72710bf22c3d1896707eeb74 (diff) |
Prepare database format for multi-stage block processing
This commit adds a status field and a transaction counter to the block
indexes.
Diffstat (limited to 'src/db.cpp')
-rw-r--r-- | src/db.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/db.cpp b/src/db.cpp index 5ca9ea2c34..e77ddd77e1 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -622,6 +622,9 @@ bool LoadBlockIndex(CChainDB &chaindb) { CBlockIndex* pindex = item.second; pindex->bnChainWork = (pindex->pprev ? pindex->pprev->bnChainWork : 0) + pindex->GetBlockWork(); + pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx; + if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS && !(pindex->nStatus & BLOCK_FAILED_MASK)) + setBlockIndexValid.insert(pindex); } // Load block file info @@ -727,20 +730,23 @@ bool CChainDB::LoadBlockIndexGuts() CBlockIndex* pindexNew = InsertBlockIndex(diskindex.GetBlockHash()); pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev); pindexNew->nHeight = diskindex.nHeight; - pindexNew->pos = diskindex.pos; + pindexNew->nFile = diskindex.nFile; + pindexNew->nDataPos = diskindex.nDataPos; pindexNew->nUndoPos = diskindex.nUndoPos; pindexNew->nVersion = diskindex.nVersion; pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot; pindexNew->nTime = diskindex.nTime; pindexNew->nBits = diskindex.nBits; pindexNew->nNonce = diskindex.nNonce; + pindexNew->nStatus = diskindex.nStatus; + pindexNew->nTx = diskindex.nTx; // Watch for genesis block if (pindexGenesisBlock == NULL && diskindex.GetBlockHash() == hashGenesisBlock) pindexGenesisBlock = pindexNew; if (!pindexNew->CheckIndex()) - return error("LoadBlockIndex() : CheckIndex failed at %d", pindexNew->nHeight); + return error("LoadBlockIndex() : CheckIndex failed: %s", pindexNew->ToString().c_str()); } else { |