mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +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;
|
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)
|
bool TestLockPointValidity(CChain& active_chain, const LockPoints& lp)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
@ -892,10 +882,7 @@ void CTxMemPool::removeForReorg(CChain& chain, std::function<bool(txiter)> check
|
|||||||
}
|
}
|
||||||
RemoveStaged(setAllRemoves, false, MemPoolRemovalReason::REORG);
|
RemoveStaged(setAllRemoves, false, MemPoolRemovalReason::REORG);
|
||||||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
|
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
|
||||||
const LockPoints lp{it->GetLockPoints()};
|
assert(TestLockPointValidity(chain, it->GetLockPoints()));
|
||||||
if (!TestLockPointValidity(chain, lp)) {
|
|
||||||
mapTx.modify(it, update_lock_points(lp));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
// Multi_index tag names
|
||||||
struct descendant_score {};
|
struct descendant_score {};
|
||||||
struct entry_time {};
|
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;
|
return should_remove;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user