32
32
from test_framework .test_framework import BitcoinTestFramework
33
33
from test_framework .util import (
34
34
assert_equal ,
35
+ assert_greater_than ,
35
36
assert_raises_rpc_error ,
36
37
)
37
38
from test_framework .wallet import (
@@ -70,7 +71,7 @@ def set_test_params(self):
70
71
self .extra_args = [
71
72
["-txindex" ],
72
73
["-txindex" ],
73
- [],
74
+ ["-fastprune" , "-prune=1" ],
74
75
]
75
76
# whitelist all peers to speed up tx relay / mempool sync
76
77
for args in self .extra_args :
@@ -85,7 +86,6 @@ def run_test(self):
85
86
self .wallet = MiniWallet (self .nodes [0 ])
86
87
87
88
self .getrawtransaction_tests ()
88
- self .getrawtransaction_verbosity_tests ()
89
89
self .createrawtransaction_tests ()
90
90
self .sendrawtransaction_tests ()
91
91
self .sendrawtransaction_testmempoolaccept_tests ()
@@ -94,6 +94,8 @@ def run_test(self):
94
94
if self .is_specified_wallet_compiled () and not self .options .descriptors :
95
95
self .import_deterministic_coinbase_privkeys ()
96
96
self .raw_multisig_transaction_legacy_tests ()
97
+ self .getrawtransaction_verbosity_tests ()
98
+
97
99
98
100
def getrawtransaction_tests (self ):
99
101
tx = self .wallet .send_self_transfer (from_node = self .nodes [0 ])
@@ -243,6 +245,13 @@ def getrawtransaction_verbosity_tests(self):
243
245
coin_base = self .nodes [1 ].getblock (block1 )['tx' ][0 ]
244
246
gottx = self .nodes [1 ].getrawtransaction (txid = coin_base , verbosity = 2 , blockhash = block1 )
245
247
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
246
255
247
256
def createrawtransaction_tests (self ):
248
257
self .log .info ("Test createrawtransaction" )
0 commit comments