|
43 | 43 | ser_uint256,
|
44 | 44 | ser_vector,
|
45 | 45 | sha256,
|
46 |
| - tx_from_hex, |
47 | 46 | )
|
48 | 47 | from test_framework.p2p import (
|
49 | 48 | P2PInterface,
|
|
89 | 88 | softfork_active,
|
90 | 89 | assert_raises_rpc_error,
|
91 | 90 | )
|
| 91 | +from test_framework.wallet import MiniWallet |
| 92 | + |
92 | 93 |
|
93 | 94 | MAX_SIGOP_COST = 80000
|
94 | 95 |
|
@@ -221,9 +222,6 @@ def set_test_params(self):
|
221 | 222 | ]
|
222 | 223 | self.supports_cli = False
|
223 | 224 |
|
224 |
| - def skip_test_if_missing_module(self): |
225 |
| - self.skip_if_no_wallet() |
226 |
| - |
227 | 225 | # Helper functions
|
228 | 226 |
|
229 | 227 | def build_next_block(self):
|
@@ -259,6 +257,7 @@ def run_test(self):
|
259 | 257 |
|
260 | 258 | self.log.info("Starting tests before segwit activation")
|
261 | 259 | self.segwit_active = False
|
| 260 | + self.wallet = MiniWallet(self.nodes[0]) |
262 | 261 |
|
263 | 262 | self.test_non_witness_transaction()
|
264 | 263 | self.test_v0_outputs_arent_spendable()
|
@@ -307,7 +306,7 @@ def test_non_witness_transaction(self):
|
307 | 306 | self.test_node.send_and_ping(msg_no_witness_block(block)) # make sure the block was processed
|
308 | 307 | txid = block.vtx[0].sha256
|
309 | 308 |
|
310 |
| - self.generate(self.nodes[0], 99) # let the block mature |
| 309 | + self.generate(self.wallet, 99) # let the block mature |
311 | 310 |
|
312 | 311 | # Create a transaction that spends the coinbase
|
313 | 312 | tx = CTransaction()
|
@@ -1999,21 +1998,13 @@ class msg_bogus_tx(msg_tx):
|
1999 | 1998 | def serialize(self):
|
2000 | 1999 | return serialize_with_bogus_witness(self.tx)
|
2001 | 2000 |
|
2002 |
| - self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(address_type='bech32'), 5) |
2003 |
| - self.generate(self.nodes[0], 1) |
2004 |
| - unspent = next(u for u in self.nodes[0].listunspent() if u['spendable'] and u['address'].startswith('bcrt')) |
2005 |
| - |
2006 |
| - raw = self.nodes[0].createrawtransaction([{"txid": unspent['txid'], "vout": unspent['vout']}], {self.nodes[0].getnewaddress(): 1}) |
2007 |
| - tx = tx_from_hex(raw) |
| 2001 | + tx = self.wallet.create_self_transfer(from_node=self.nodes[0])['tx'] |
2008 | 2002 | assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
|
2009 |
| - with self.nodes[0].assert_debug_log(['Superfluous witness record']): |
| 2003 | + with self.nodes[0].assert_debug_log(['Unknown transaction optional data']): |
2010 | 2004 | self.test_node.send_and_ping(msg_bogus_tx(tx))
|
2011 |
| - raw = self.nodes[0].signrawtransactionwithwallet(raw) |
2012 |
| - assert raw['complete'] |
2013 |
| - raw = raw['hex'] |
2014 |
| - tx = tx_from_hex(raw) |
| 2005 | + tx.wit.vtxinwit = [] # drop witness |
2015 | 2006 | assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
|
2016 |
| - with self.nodes[0].assert_debug_log(['Unknown transaction optional data']): |
| 2007 | + with self.nodes[0].assert_debug_log(['Superfluous witness record']): |
2017 | 2008 | self.test_node.send_and_ping(msg_bogus_tx(tx))
|
2018 | 2009 |
|
2019 | 2010 | @subtest
|
|
0 commit comments