mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
merge bitcoin#23683: valid but different LockPoints after a reorg
This commit is contained in:
parent
e85862ba11
commit
150ca008fe
@ -72,16 +72,6 @@ private:
|
||||
int64_t feeDelta;
|
||||
};
|
||||
|
||||
struct update_lock_points
|
||||
{
|
||||
explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { }
|
||||
|
||||
void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); }
|
||||
|
||||
private:
|
||||
const LockPoints& lp;
|
||||
};
|
||||
|
||||
bool TestLockPointValidity(CChain& active_chain, const LockPoints& lp)
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
@ -892,10 +882,7 @@ void CTxMemPool::removeForReorg(CChain& chain, std::function<bool(txiter)> check
|
||||
}
|
||||
RemoveStaged(setAllRemoves, false, MemPoolRemovalReason::REORG);
|
||||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
|
||||
const LockPoints lp{it->GetLockPoints()};
|
||||
if (!TestLockPointValidity(chain, lp)) {
|
||||
mapTx.modify(it, update_lock_points(lp));
|
||||
}
|
||||
assert(TestLockPointValidity(chain, it->GetLockPoints()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -308,6 +308,16 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct update_lock_points
|
||||
{
|
||||
explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { }
|
||||
|
||||
void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); }
|
||||
|
||||
private:
|
||||
const LockPoints& lp;
|
||||
};
|
||||
|
||||
// Multi_index tag names
|
||||
struct descendant_score {};
|
||||
struct entry_time {};
|
||||
|
@ -399,6 +399,8 @@ void CChainState::MaybeUpdateMempoolForReorg(
|
||||
}
|
||||
}
|
||||
}
|
||||
// CheckSequenceLocks updates lp. Update the mempool entry LockPoints.
|
||||
if (!validLP) m_mempool->mapTx.modify(it, update_lock_points(lp));
|
||||
return should_remove;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user