Skip to content

Commit cd32160

Browse files
committed
Remove use of GetTransactionAncestry in wallet code
This commit does not change behavior.
1 parent 291276f commit cd32160

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/interfaces/chain.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ class ChainImpl : public Chain
196196
auto it_mp = ::mempool.mapTx.find(txid);
197197
return it_mp != ::mempool.mapTx.end() && it_mp->GetCountWithDescendants() > 1;
198198
}
199+
void getTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) override
200+
{
201+
::mempool.GetTransactionAncestry(txid, ancestors, descendants);
202+
}
199203
};
200204

201205
} // namespace

src/interfaces/chain.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <policy/rbf.h> // For RBFTransactionState
1010

1111
#include <memory>
12+
#include <stddef.h>
1213
#include <stdint.h>
1314
#include <string>
1415
#include <vector>
@@ -138,6 +139,9 @@ class Chain
138139

139140
//! Check if transaction has descendants in mempool.
140141
virtual bool hasDescendantsInMempool(const uint256& txid) = 0;
142+
143+
//! Calculate mempool ancestor and descendant counts for the given transaction.
144+
virtual void getTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) = 0;
141145
};
142146

143147
//! Interface to let node manage chain clients (wallets, or maybe tools for

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4528,7 +4528,7 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& outpu
45284528
CInputCoin input_coin = output.GetInputCoin();
45294529

45304530
size_t ancestors, descendants;
4531-
mempool.GetTransactionAncestry(output.tx->GetHash(), ancestors, descendants);
4531+
chain().getTransactionAncestry(output.tx->GetHash(), ancestors, descendants);
45324532
if (!single_coin && ExtractDestination(output.tx->tx->vout[output.i].scriptPubKey, dst)) {
45334533
// Limit output groups to no more than 10 entries, to protect
45344534
// against inadvertently creating a too-large transaction

0 commit comments

Comments
 (0)