CValidationInterface: modify the parameter of TransactionAddedToMempool

Create a new struct `NewMempoolTransactionInfo` that will be used as the new parameter of
`TransactionAddedToMempool` callback.
This commit is contained in:
ismaelsadeeq
2023-11-03 17:04:30 +01:00
parent 91532bd382
commit dff5ad3b99
9 changed files with 64 additions and 19 deletions

View File

@@ -55,13 +55,13 @@ struct OutpointsUpdater final : public CValidationInterface {
explicit OutpointsUpdater(std::set<COutPoint>& r)
: m_mempool_outpoints{r} {}
void TransactionAddedToMempool(const CTransactionRef& tx, uint64_t /* mempool_sequence */) override
void TransactionAddedToMempool(const NewMempoolTransactionInfo& tx, uint64_t /* mempool_sequence */) override
{
// for coins spent we always want to be able to rbf so they're not removed
// outputs from this tx can now be spent
for (uint32_t index{0}; index < tx->vout.size(); ++index) {
m_mempool_outpoints.insert(COutPoint{tx->GetHash(), index});
for (uint32_t index{0}; index < tx.info.m_tx->vout.size(); ++index) {
m_mempool_outpoints.insert(COutPoint{tx.info.m_tx->GetHash(), index});
}
}
@@ -85,10 +85,10 @@ struct TransactionsDelta final : public CValidationInterface {
explicit TransactionsDelta(std::set<CTransactionRef>& a)
: m_added{a} {}
void TransactionAddedToMempool(const CTransactionRef& tx, uint64_t /* mempool_sequence */) override
void TransactionAddedToMempool(const NewMempoolTransactionInfo& tx, uint64_t /* mempool_sequence */) override
{
// Transactions may be entered and booted any number of times
m_added.insert(tx);
m_added.insert(tx.info.m_tx);
}
void TransactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t /* mempool_sequence */) override