aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorstickies-v <stickies-v@protonmail.com>2022-10-09 17:19:06 +0100
committerstickies-v <stickies-v@protonmail.com>2022-12-13 15:42:49 +0000
commitf911bdfff95eba3793fffaf71a31cc8bfc6f80c9 (patch)
tree3ea4d4ae42f038409ccf60af7e7c267bcc1305fa /src/node
parent66e028f7399b6511f9b73b1cef54b6a6ac38a024 (diff)
mempool: use util::Result for CalculateMemPoolAncestors
Avoid using setAncestors outparameter, simplify function signatures and avoid creating unused dummy strings.
Diffstat (limited to 'src/node')
-rw-r--r--src/node/interfaces.cpp5
-rw-r--r--src/node/miner.cpp5
2 files changed, 3 insertions, 7 deletions
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index 212780b259..7b9baeaf3b 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -672,12 +672,9 @@ public:
if (!m_node.mempool) return true;
LockPoints lp;
CTxMemPoolEntry entry(tx, 0, 0, 0, false, 0, lp);
- CTxMemPool::setEntries ancestors;
const CTxMemPool::Limits& limits{m_node.mempool->m_limits};
- std::string unused_error_string;
LOCK(m_node.mempool->cs);
- return m_node.mempool->CalculateMemPoolAncestors(
- entry, ancestors, limits, unused_error_string);
+ return m_node.mempool->CalculateMemPoolAncestors(entry, limits).has_value();
}
CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation* calc) override
{
diff --git a/src/node/miner.cpp b/src/node/miner.cpp
index e11ec5b0f1..e507c1381c 100644
--- a/src/node/miner.cpp
+++ b/src/node/miner.cpp
@@ -394,9 +394,8 @@ void BlockAssembler::addPackageTxs(const CTxMemPool& mempool, int& nPackagesSele
continue;
}
- CTxMemPool::setEntries ancestors;
- std::string dummy;
- mempool.CalculateMemPoolAncestors(*iter, ancestors, CTxMemPool::Limits::NoLimits(), dummy, false);
+ auto ancestors_result{mempool.CalculateMemPoolAncestors(*iter, CTxMemPool::Limits::NoLimits(), /*fSearchForParents=*/false)};
+ auto ancestors{std::move(ancestors_result).value_or(CTxMemPool::setEntries{})};
onlyUnconfirmed(ancestors);
ancestors.insert(iter);