Remove use of GetCountWithDescendants in wallet code
This commit does not change behavior.
This commit is contained in:
parent
bdc6628683
commit
291276f7f4
3 changed files with 10 additions and 3 deletions
|
@ -190,6 +190,12 @@ public:
|
||||||
LOCK(::mempool.cs);
|
LOCK(::mempool.cs);
|
||||||
return IsRBFOptIn(tx, ::mempool);
|
return IsRBFOptIn(tx, ::mempool);
|
||||||
}
|
}
|
||||||
|
bool hasDescendantsInMempool(const uint256& txid) override
|
||||||
|
{
|
||||||
|
LOCK(::mempool.cs);
|
||||||
|
auto it_mp = ::mempool.mapTx.find(txid);
|
||||||
|
return it_mp != ::mempool.mapTx.end() && it_mp->GetCountWithDescendants() > 1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -135,6 +135,9 @@ public:
|
||||||
|
|
||||||
//! Check if transaction is RBF opt in.
|
//! Check if transaction is RBF opt in.
|
||||||
virtual RBFTransactionState isRBFOptIn(const CTransaction& tx) = 0;
|
virtual RBFTransactionState isRBFOptIn(const CTransaction& tx) = 0;
|
||||||
|
|
||||||
|
//! Check if transaction has descendants in mempool.
|
||||||
|
virtual bool hasDescendantsInMempool(const uint256& txid) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Interface to let node manage chain clients (wallets, or maybe tools for
|
//! Interface to let node manage chain clients (wallets, or maybe tools for
|
||||||
|
|
|
@ -27,9 +27,7 @@ static feebumper::Result PreconditionChecks(interfaces::Chain::Lock& locked_chai
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(mempool.cs);
|
if (wallet->chain().hasDescendantsInMempool(wtx.GetHash())) {
|
||||||
auto it_mp = mempool.mapTx.find(wtx.GetHash());
|
|
||||||
if (it_mp != mempool.mapTx.end() && it_mp->GetCountWithDescendants() > 1) {
|
|
||||||
errors.push_back("Transaction has descendants in the mempool");
|
errors.push_back("Transaction has descendants in the mempool");
|
||||||
return feebumper::Result::INVALID_PARAMETER;
|
return feebumper::Result::INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue