Skip to content

Commit c6f710e

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23052: test: use miniwallet in test_rpc function in feature_rbf.py
74c0d81 test: use miniwallet in test_rpc() function in feature_rbf.py (Shubhankar) Pull request description: This PR aims to further increase MiniWallet usage in the functional test feature_rbf.py by using it in the test_rpc(...) . Sub test needs wallet to get a utxo for creating raw txn, and to get address for output, address can be hardcoded and mini wallet can be used for utxo. fund raw transaction is a wallet rpc and should be tested only when bitcoin core is compiled with wallet ACKs for top commit: laanwj: Code review ACK 74c0d81 theStack: tACK 74c0d81 Tree-SHA512: a98cc0df0fe70ee113a293cd4fd659c5bece47c17937d368193b65b150b331a2c694cdeb2792386f1a6deefb8d6750ed83ffa0ae6f9d13fa2b7625cd80bc692a
2 parents 573b462 + 74c0d81 commit c6f710e

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

test/functional/feature_rbf.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
DUMMY_2_P2WPKH_SCRIPT,
2727
)
2828
from test_framework.wallet import MiniWallet
29-
29+
from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE
3030

3131
MAX_REPLACEMENT_LIMIT = 100
3232
class ReplaceByFeeTest(BitcoinTestFramework):
@@ -44,9 +44,6 @@ def set_test_params(self):
4444
]
4545
self.supports_cli = False
4646

47-
def skip_test_if_missing_module(self):
48-
self.skip_if_no_wallet()
49-
5047
def run_test(self):
5148
self.wallet = MiniWallet(self.nodes[0])
5249
# the pre-mined test framework chain contains coinbase outputs to the
@@ -531,24 +528,26 @@ def test_prioritised_transactions(self):
531528
assert tx2b_txid in self.nodes[0].getrawmempool()
532529

533530
def test_rpc(self):
534-
us0 = self.nodes[0].listunspent()[0]
531+
us0 = self.wallet.get_utxo()
535532
ins = [us0]
536-
outs = {self.nodes[0].getnewaddress(): Decimal(1.0000000)}
533+
outs = {ADDRESS_BCRT1_UNSPENDABLE: Decimal(1.0000000)}
537534
rawtx0 = self.nodes[0].createrawtransaction(ins, outs, 0, True)
538535
rawtx1 = self.nodes[0].createrawtransaction(ins, outs, 0, False)
539536
json0 = self.nodes[0].decoderawtransaction(rawtx0)
540537
json1 = self.nodes[0].decoderawtransaction(rawtx1)
541538
assert_equal(json0["vin"][0]["sequence"], 4294967293)
542539
assert_equal(json1["vin"][0]["sequence"], 4294967295)
543540

544-
rawtx2 = self.nodes[0].createrawtransaction([], outs)
545-
frawtx2a = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": True})
546-
frawtx2b = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": False})
541+
if self.is_wallet_compiled():
542+
self.init_wallet(0)
543+
rawtx2 = self.nodes[0].createrawtransaction([], outs)
544+
frawtx2a = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": True})
545+
frawtx2b = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": False})
547546

548-
json0 = self.nodes[0].decoderawtransaction(frawtx2a['hex'])
549-
json1 = self.nodes[0].decoderawtransaction(frawtx2b['hex'])
550-
assert_equal(json0["vin"][0]["sequence"], 4294967293)
551-
assert_equal(json1["vin"][0]["sequence"], 4294967294)
547+
json0 = self.nodes[0].decoderawtransaction(frawtx2a['hex'])
548+
json1 = self.nodes[0].decoderawtransaction(frawtx2b['hex'])
549+
assert_equal(json0["vin"][0]["sequence"], 4294967293)
550+
assert_equal(json1["vin"][0]["sequence"], 4294967294)
552551

553552
def test_no_inherited_signaling(self):
554553
confirmed_utxo = self.wallet.get_utxo()

0 commit comments

Comments
 (0)