Fix multi-block reorg transaction resurrection
This commit is contained in:
parent
d9ace8abe8
commit
9bf2a4aba2
1 changed files with 3 additions and 3 deletions
|
@ -1938,7 +1938,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect shorter branch
|
// Disconnect shorter branch
|
||||||
vector<CTransaction> vResurrect;
|
list<CTransaction> vResurrect;
|
||||||
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) {
|
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) {
|
||||||
CBlock block;
|
CBlock block;
|
||||||
if (!ReadBlockFromDisk(block, pindex))
|
if (!ReadBlockFromDisk(block, pindex))
|
||||||
|
@ -1952,9 +1952,9 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
|
||||||
// Queue memory transactions to resurrect.
|
// Queue memory transactions to resurrect.
|
||||||
// We only do this for blocks after the last checkpoint (reorganisation before that
|
// We only do this for blocks after the last checkpoint (reorganisation before that
|
||||||
// point should only happen with -reindex/-loadblock, or a misbehaving peer.
|
// point should only happen with -reindex/-loadblock, or a misbehaving peer.
|
||||||
BOOST_FOREACH(const CTransaction& tx, block.vtx)
|
BOOST_REVERSE_FOREACH(const CTransaction& tx, block.vtx)
|
||||||
if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate())
|
if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate())
|
||||||
vResurrect.push_back(tx);
|
vResurrect.push_front(tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect longer branch
|
// Connect longer branch
|
||||||
|
|
Loading…
Reference in a new issue