From 418557034055f740951294e7677ae9fd5149ea9b Mon Sep 17 00:00:00 2001 From: t-bast Date: Mon, 25 Apr 2022 10:29:25 +0200 Subject: Add RPC to get mempool txs spending outputs We add an RPC to fetch the mempool transactions spending given outpoints. Without this RPC, application developers would need to first call `getrawmempool` which returns a long list of `txid`, then fetch each of these txs individually to check whether they spend the given outpoint(s). This RPC can later be enriched to also find confirmed transactions instead of being restricted to mempool transactions. --- test/functional/mempool_packages.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/functional/mempool_packages.py') diff --git a/test/functional/mempool_packages.py b/test/functional/mempool_packages.py index 068fdc0b65..a2a2caf324 100755 --- a/test/functional/mempool_packages.py +++ b/test/functional/mempool_packages.py @@ -100,6 +100,12 @@ class MempoolPackagesTest(BitcoinTestFramework): entry = self.nodes[0].getmempoolentry(x) assert_equal(entry, mempool[x]) + # Check that gettxspendingprevout is consistent with getrawmempool + witnesstx = self.nodes[0].gettransaction(txid=x, verbose=True)['decoded'] + for tx_in in witnesstx["vin"]: + spending_result = self.nodes[0].gettxspendingprevout([ {'txid' : tx_in["txid"], 'vout' : tx_in["vout"]} ]) + assert_equal(spending_result, [ {'txid' : tx_in["txid"], 'vout' : tx_in["vout"], 'spendingtxid' : x} ]) + # Check that the descendant calculations are correct assert_equal(entry['descendantcount'], descendant_count) descendant_fees += entry['fees']['base'] -- cgit v1.2.3