diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -144,6 +145,11 @@ //! Check if transaction has descendants in mempool. virtual bool hasDescendantsInMempool(const TxId &txid) = 0; + + //! Calculate mempool ancestor and descendant counts for the given + //! transaction. + virtual void getTransactionAncestry(const TxId &txid, size_t &ancestors, + size_t &descendants) = 0; }; //! Interface to let node manage chain clients (wallets, or maybe tools for diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -194,6 +194,10 @@ return it_mp != ::g_mempool.mapTx.end() && it_mp->GetCountWithDescendants() > 1; } + void getTransactionAncestry(const TxId &txid, size_t &ancestors, + size_t &descendants) override { + ::g_mempool.GetTransactionAncestry(txid, ancestors, descendants); + } }; } // namespace diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4913,8 +4913,8 @@ CInputCoin input_coin = output.GetInputCoin(); size_t ancestors, descendants; - g_mempool.GetTransactionAncestry(output.tx->GetId(), ancestors, - descendants); + chain().getTransactionAncestry(output.tx->GetId(), ancestors, + descendants); if (!single_coin && ExtractDestination(output.tx->tx->vout[output.i].scriptPubKey, dst)) {