mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-26 08:51:55 +02:00
Merge bitcoin/bitcoin#23052: test: use miniwallet in test_rpc function in feature_rbf.py
74c0d81b46150923f9af9631f4e3ecf80213cca2 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 74c0d81b46150923f9af9631f4e3ecf80213cca2 theStack: tACK 74c0d81b46150923f9af9631f4e3ecf80213cca2 Tree-SHA512: a98cc0df0fe70ee113a293cd4fd659c5bece47c17937d368193b65b150b331a2c694cdeb2792386f1a6deefb8d6750ed83ffa0ae6f9d13fa2b7625cd80bc692a
This commit is contained in:
commit
c6f710ec98
@ -26,7 +26,7 @@ from test_framework.script_util import (
|
|||||||
DUMMY_2_P2WPKH_SCRIPT,
|
DUMMY_2_P2WPKH_SCRIPT,
|
||||||
)
|
)
|
||||||
from test_framework.wallet import MiniWallet
|
from test_framework.wallet import MiniWallet
|
||||||
|
from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE
|
||||||
|
|
||||||
MAX_REPLACEMENT_LIMIT = 100
|
MAX_REPLACEMENT_LIMIT = 100
|
||||||
class ReplaceByFeeTest(BitcoinTestFramework):
|
class ReplaceByFeeTest(BitcoinTestFramework):
|
||||||
@ -44,9 +44,6 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||||||
]
|
]
|
||||||
self.supports_cli = False
|
self.supports_cli = False
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
|
||||||
self.skip_if_no_wallet()
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
self.wallet = MiniWallet(self.nodes[0])
|
self.wallet = MiniWallet(self.nodes[0])
|
||||||
# the pre-mined test framework chain contains coinbase outputs to the
|
# the pre-mined test framework chain contains coinbase outputs to the
|
||||||
@ -531,9 +528,9 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||||||
assert tx2b_txid in self.nodes[0].getrawmempool()
|
assert tx2b_txid in self.nodes[0].getrawmempool()
|
||||||
|
|
||||||
def test_rpc(self):
|
def test_rpc(self):
|
||||||
us0 = self.nodes[0].listunspent()[0]
|
us0 = self.wallet.get_utxo()
|
||||||
ins = [us0]
|
ins = [us0]
|
||||||
outs = {self.nodes[0].getnewaddress(): Decimal(1.0000000)}
|
outs = {ADDRESS_BCRT1_UNSPENDABLE: Decimal(1.0000000)}
|
||||||
rawtx0 = self.nodes[0].createrawtransaction(ins, outs, 0, True)
|
rawtx0 = self.nodes[0].createrawtransaction(ins, outs, 0, True)
|
||||||
rawtx1 = self.nodes[0].createrawtransaction(ins, outs, 0, False)
|
rawtx1 = self.nodes[0].createrawtransaction(ins, outs, 0, False)
|
||||||
json0 = self.nodes[0].decoderawtransaction(rawtx0)
|
json0 = self.nodes[0].decoderawtransaction(rawtx0)
|
||||||
@ -541,6 +538,8 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
|||||||
assert_equal(json0["vin"][0]["sequence"], 4294967293)
|
assert_equal(json0["vin"][0]["sequence"], 4294967293)
|
||||||
assert_equal(json1["vin"][0]["sequence"], 4294967295)
|
assert_equal(json1["vin"][0]["sequence"], 4294967295)
|
||||||
|
|
||||||
|
if self.is_wallet_compiled():
|
||||||
|
self.init_wallet(0)
|
||||||
rawtx2 = self.nodes[0].createrawtransaction([], outs)
|
rawtx2 = self.nodes[0].createrawtransaction([], outs)
|
||||||
frawtx2a = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": True})
|
frawtx2a = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": True})
|
||||||
frawtx2b = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": False})
|
frawtx2b = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": False})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user