3232from test_framework .test_framework import BitcoinTestFramework
3333from test_framework .util import (
3434 assert_equal ,
35+ assert_greater_than ,
3536 assert_raises_rpc_error ,
3637)
3738from test_framework .wallet import (
@@ -70,7 +71,7 @@ def set_test_params(self):
7071 self .extra_args = [
7172 ["-txindex" ],
7273 ["-txindex" ],
73- [],
74+ ["-fastprune" , "-prune=1" ],
7475 ]
7576 # whitelist all peers to speed up tx relay / mempool sync
7677 for args in self .extra_args :
@@ -85,7 +86,6 @@ def run_test(self):
8586 self .wallet = MiniWallet (self .nodes [0 ])
8687
8788 self .getrawtransaction_tests ()
88- self .getrawtransaction_verbosity_tests ()
8989 self .createrawtransaction_tests ()
9090 self .sendrawtransaction_tests ()
9191 self .sendrawtransaction_testmempoolaccept_tests ()
@@ -94,6 +94,8 @@ def run_test(self):
9494 if self .is_specified_wallet_compiled () and not self .options .descriptors :
9595 self .import_deterministic_coinbase_privkeys ()
9696 self .raw_multisig_transaction_legacy_tests ()
97+ self .getrawtransaction_verbosity_tests ()
98+
9799
98100 def getrawtransaction_tests (self ):
99101 tx = self .wallet .send_self_transfer (from_node = self .nodes [0 ])
@@ -243,6 +245,13 @@ def getrawtransaction_verbosity_tests(self):
243245 coin_base = self .nodes [1 ].getblock (block1 )['tx' ][0 ]
244246 gottx = self .nodes [1 ].getrawtransaction (txid = coin_base , verbosity = 2 , blockhash = block1 )
245247 assert 'fee' not in gottx
248+ # check that verbosity 2 for a mempool tx will fallback to verbosity 1
249+ # Do this with a pruned chain, as a regression test for https://github.com/bitcoin/bitcoin/pull/29003
250+ self .generate (self .nodes [2 ], 400 )
251+ assert_greater_than (self .nodes [2 ].pruneblockchain (250 ), 0 )
252+ mempool_tx = self .wallet .send_self_transfer (from_node = self .nodes [2 ])['txid' ]
253+ gottx = self .nodes [2 ].getrawtransaction (txid = mempool_tx , verbosity = 2 )
254+ assert 'fee' not in gottx
246255
247256 def createrawtransaction_tests (self ):
248257 self .log .info ("Test createrawtransaction" )
0 commit comments