Skip to content

Commit 4037478

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26610: test: Remove unused blocktools imports from wallet_bumpfee
fa15c67 test: Remove unused blocktools imports from wallet_bumpfee (MarcoFalke) Pull request description: Seems bloaty and confusing to use "tools" when a single RPC can already achieve the same. ACKs for top commit: theStack: ACK fa15c67 Tree-SHA512: 87f9c31bbb286fee5e479ae54a1f9131f4d4294d665a985df8b14a0cc837a2a2e145ccd3660612768d88cfa0827a3eef392f85519b6cb7df365ba9fadafb0a41
2 parents 0251511 + fa15c67 commit 4037478

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

test/functional/wallet_bumpfee.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717

1818
from test_framework.blocktools import (
1919
COINBASE_MATURITY,
20-
add_witness_commitment,
21-
create_block,
22-
create_coinbase,
23-
send_to_witness,
2420
)
2521
from test_framework.messages import (
2622
MAX_BIP125_RBF_SEQUENCE,
@@ -203,16 +199,8 @@ def test_segwit_bumpfee_succeeds(self, rbf_node, dest_address):
203199
# Create a transaction with segwit output, then create an RBF transaction
204200
# which spends it, and make sure bumpfee can be called on it.
205201

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"]
216204

217205
rbfraw = rbf_node.createrawtransaction([{
218206
'txid': segwitid,
@@ -544,10 +532,10 @@ def test_unconfirmed_not_spendable(self, rbf_node, rbf_node_address):
544532
# then invalidate the block so the rbf tx will be put back in the mempool.
545533
# This makes it possible to check whether the rbf tx outputs are
546534
# 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])
548536
# Can not abandon conflicted tx
549537
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"])
551539
# Call abandon to make sure the wallet doesn't attempt to resubmit
552540
# the bump tx and hope the wallet does not rebroadcast before we call.
553541
rbf_node.abandontransaction(bumpid)
@@ -622,17 +610,6 @@ def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")):
622610
return txid
623611

624612

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-
636613
def test_no_more_inputs_fails(self, rbf_node, dest_address):
637614
self.log.info('Test that bumpfee fails when there are no available confirmed outputs')
638615
# feerate rbf requires confirmed outputs when change output doesn't exist or is insufficient

0 commit comments

Comments
 (0)