|
17 | 17 |
|
18 | 18 | from test_framework.blocktools import (
|
19 | 19 | COINBASE_MATURITY,
|
20 |
| - add_witness_commitment, |
21 |
| - create_block, |
22 |
| - create_coinbase, |
23 |
| - send_to_witness, |
24 | 20 | )
|
25 | 21 | from test_framework.messages import (
|
26 | 22 | MAX_BIP125_RBF_SEQUENCE,
|
@@ -203,16 +199,8 @@ def test_segwit_bumpfee_succeeds(self, rbf_node, dest_address):
|
203 | 199 | # Create a transaction with segwit output, then create an RBF transaction
|
204 | 200 | # which spends it, and make sure bumpfee can be called on it.
|
205 | 201 |
|
206 |
| - segwit_in = next(u for u in rbf_node.listunspent() if u["amount"] == Decimal("0.001")) |
207 |
| - segwit_out = rbf_node.getaddressinfo(rbf_node.getnewaddress(address_type='bech32')) |
208 |
| - segwitid = send_to_witness( |
209 |
| - use_p2wsh=False, |
210 |
| - node=rbf_node, |
211 |
| - utxo=segwit_in, |
212 |
| - pubkey=segwit_out["pubkey"], |
213 |
| - encode_p2sh=False, |
214 |
| - amount=Decimal("0.0009"), |
215 |
| - sign=True) |
| 202 | + segwit_out = rbf_node.getnewaddress(address_type='bech32') |
| 203 | + segwitid = rbf_node.send({segwit_out: "0.0009"}, options={"change_position": 1})["txid"] |
216 | 204 |
|
217 | 205 | rbfraw = rbf_node.createrawtransaction([{
|
218 | 206 | 'txid': segwitid,
|
@@ -544,10 +532,10 @@ def test_unconfirmed_not_spendable(self, rbf_node, rbf_node_address):
|
544 | 532 | # then invalidate the block so the rbf tx will be put back in the mempool.
|
545 | 533 | # This makes it possible to check whether the rbf tx outputs are
|
546 | 534 | # spendable before the rbf tx is confirmed.
|
547 |
| - block = submit_block_with_tx(rbf_node, rbftx) |
| 535 | + block = self.generateblock(rbf_node, output="raw(51)", transactions=[rbftx]) |
548 | 536 | # Can not abandon conflicted tx
|
549 | 537 | assert_raises_rpc_error(-5, 'Transaction not eligible for abandonment', lambda: rbf_node.abandontransaction(txid=bumpid))
|
550 |
| - rbf_node.invalidateblock(block.hash) |
| 538 | + rbf_node.invalidateblock(block["hash"]) |
551 | 539 | # Call abandon to make sure the wallet doesn't attempt to resubmit
|
552 | 540 | # the bump tx and hope the wallet does not rebroadcast before we call.
|
553 | 541 | rbf_node.abandontransaction(bumpid)
|
@@ -622,17 +610,6 @@ def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")):
|
622 | 610 | return txid
|
623 | 611 |
|
624 | 612 |
|
625 |
| -def submit_block_with_tx(node, tx): |
626 |
| - tip = node.getbestblockhash() |
627 |
| - height = node.getblockcount() + 1 |
628 |
| - block_time = node.getblockheader(tip)["mediantime"] + 1 |
629 |
| - block = create_block(int(tip, 16), create_coinbase(height), block_time, txlist=[tx]) |
630 |
| - add_witness_commitment(block) |
631 |
| - block.solve() |
632 |
| - node.submitblock(block.serialize().hex()) |
633 |
| - return block |
634 |
| - |
635 |
| - |
636 | 613 | def test_no_more_inputs_fails(self, rbf_node, dest_address):
|
637 | 614 | self.log.info('Test that bumpfee fails when there are no available confirmed outputs')
|
638 | 615 | # feerate rbf requires confirmed outputs when change output doesn't exist or is insufficient
|
|
0 commit comments