mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 14:14:00 +01:00
Merge #9490: Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.
4b06e41Add unit test for FindEarliestAtLeast (Suhas Daftuar)997a98aReplace FindLatestBefore used by importmuti with FindEarliestAtLeast. (Gregory Maxwell)
This commit is contained in:
@@ -2611,6 +2611,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
|
||||
pindexNew->nHeight = pindexNew->pprev->nHeight + 1;
|
||||
pindexNew->BuildSkip();
|
||||
}
|
||||
pindexNew->nTimeMax = (pindexNew->pprev ? std::max(pindexNew->pprev->nTimeMax, pindexNew->nTime) : pindexNew->nTime);
|
||||
pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + GetBlockProof(*pindexNew);
|
||||
pindexNew->RaiseValidity(BLOCK_VALID_TREE);
|
||||
if (pindexBestHeader == NULL || pindexBestHeader->nChainWork < pindexNew->nChainWork)
|
||||
@@ -3432,6 +3433,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
|
||||
{
|
||||
CBlockIndex* pindex = item.second;
|
||||
pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex);
|
||||
pindex->nTimeMax = (pindex->pprev ? std::max(pindex->pprev->nTimeMax, pindex->nTime) : pindex->nTime);
|
||||
// We can link the chain of blocks for which we've received transactions at some point.
|
||||
// Pruned nodes may have deleted the block.
|
||||
if (pindex->nTx > 0) {
|
||||
|
||||
Reference in New Issue
Block a user