mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
mempool: use util::Result for CalculateMemPoolAncestors
Avoid using setAncestors outparameter, simplify function signatures and avoid creating unused dummy strings.
This commit is contained in:
@@ -16,14 +16,13 @@
|
||||
#include <util/rbf.h>
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
|
||||
{
|
||||
AssertLockHeld(pool.cs);
|
||||
|
||||
CTxMemPool::setEntries ancestors;
|
||||
|
||||
// First check the transaction itself.
|
||||
if (SignalsOptInRBF(tx)) {
|
||||
return RBFTransactionState::REPLACEABLE_BIP125;
|
||||
@@ -37,9 +36,9 @@ RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
|
||||
|
||||
// If all the inputs have nSequence >= maxint-1, it still might be
|
||||
// signaled for RBF if any unconfirmed parents have signaled.
|
||||
std::string dummy;
|
||||
CTxMemPoolEntry entry = *pool.mapTx.find(tx.GetHash());
|
||||
pool.CalculateMemPoolAncestors(entry, ancestors, CTxMemPool::Limits::NoLimits(), dummy, false);
|
||||
auto ancestors_result{pool.CalculateMemPoolAncestors(entry, CTxMemPool::Limits::NoLimits(), /*fSearchForParents=*/false)};
|
||||
auto ancestors{std::move(ancestors_result).value_or(CTxMemPool::setEntries{})};
|
||||
|
||||
for (CTxMemPool::txiter it : ancestors) {
|
||||
if (SignalsOptInRBF(it->GetTx())) {
|
||||
|
||||
Reference in New Issue
Block a user