From cd32160af0528cc746968ee0eadf4f63c98665f2 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Fri, 28 Jul 2017 19:42:27 -0400 Subject: [PATCH] Remove use of GetTransactionAncestry in wallet code This commit does not change behavior. --- src/interfaces/chain.cpp | 4 ++++ src/interfaces/chain.h | 4 ++++ src/wallet/wallet.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index 8c5921970b..d7bad0543c 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -196,6 +196,10 @@ public: auto it_mp = ::mempool.mapTx.find(txid); return it_mp != ::mempool.mapTx.end() && it_mp->GetCountWithDescendants() > 1; } + void getTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) override + { + ::mempool.GetTransactionAncestry(txid, ancestors, descendants); + } }; } // namespace diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index aa4f17a8ec..33bbfefd9f 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -9,6 +9,7 @@ #include // For RBFTransactionState #include +#include #include #include #include @@ -138,6 +139,9 @@ public: //! Check if transaction has descendants in mempool. virtual bool hasDescendantsInMempool(const uint256& txid) = 0; + + //! Calculate mempool ancestor and descendant counts for the given transaction. + virtual void getTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) = 0; }; //! Interface to let node manage chain clients (wallets, or maybe tools for diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index eb99c6cd77..a77b1c60f2 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4528,7 +4528,7 @@ std::vector CWallet::GroupOutputs(const std::vector& outpu CInputCoin input_coin = output.GetInputCoin(); size_t ancestors, descendants; - mempool.GetTransactionAncestry(output.tx->GetHash(), ancestors, descendants); + chain().getTransactionAncestry(output.tx->GetHash(), ancestors, descendants); if (!single_coin && ExtractDestination(output.tx->tx->vout[output.i].scriptPubKey, dst)) { // Limit output groups to no more than 10 entries, to protect // against inadvertently creating a too-large transaction