Skip to content

Commit 94b528b

Browse files
committed
[qa] Remove bumpfee.py get_change_address hack
1 parent 919aaf6 commit 94b528b

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

test/functional/bumpfee.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_segwit_bumpfee_succeeds(rbf_node, dest_address):
115115
'vout': 0,
116116
"sequence": BIP125_SEQUENCE_NUMBER
117117
}], {dest_address: Decimal("0.0005"),
118-
get_change_address(rbf_node): Decimal("0.0003")})
118+
rbf_node.getrawchangeaddress(): Decimal("0.0003")})
119119
rbfsigned = rbf_node.signrawtransaction(rbfraw)
120120
rbfid = rbf_node.sendrawtransaction(rbfsigned["hex"])
121121
assert rbfid in rbf_node.getrawmempool()
@@ -167,13 +167,15 @@ def test_small_output_fails(rbf_node, dest_address):
167167
rbfid = spend_one_input(rbf_node,
168168
Decimal("0.00100000"),
169169
{dest_address: 0.00080000,
170-
get_change_address(rbf_node): Decimal("0.00010000")})
170+
rbf_node.getrawchangeaddress(): Decimal("0.00010000")})
171171
rbf_node.bumpfee(rbfid, {"totalFee": 20000})
172172

173173
rbfid = spend_one_input(rbf_node,
174174
Decimal("0.00100000"),
175175
{dest_address: 0.00080000,
176176
get_change_address(rbf_node): Decimal("0.00010000")})
177+
get_change_address(rbf_node): Decimal("0.00010000")})
178+
rbf_node.getrawchangeaddress(): Decimal("0.00010000")})
177179
assert_raises_jsonrpc(-4, "Change output is too small", rbf_node.bumpfee, rbfid, {"totalFee": 20001})
178180

179181

@@ -183,7 +185,7 @@ def test_dust_to_fee(rbf_node, dest_address):
183185
rbfid = spend_one_input(rbf_node,
184186
Decimal("0.00100000"),
185187
{dest_address: 0.00080000,
186-
get_change_address(rbf_node): Decimal("0.00010000")})
188+
rbf_node.getrawchangeaddress(): Decimal("0.00010000")})
187189
fulltx = rbf_node.getrawtransaction(rbfid, 1)
188190
bumped_tx = rbf_node.bumpfee(rbfid, {"totalFee": 19900})
189191
full_bumped_tx = rbf_node.getrawtransaction(bumped_tx["txid"], 1)
@@ -288,21 +290,6 @@ def spend_one_input(node, input_amount, outputs):
288290
return txid
289291

290292

291-
def get_change_address(node):
292-
"""Get a wallet change address.
293-
294-
There is no wallet RPC to access unused change addresses, so this creates a
295-
dummy transaction, calls fundrawtransaction to give add an input and change
296-
output, then returns the change address."""
297-
dest_address = node.getnewaddress()
298-
dest_amount = Decimal("0.00012345")
299-
rawtx = node.createrawtransaction([], {dest_address: dest_amount})
300-
fundtx = node.fundrawtransaction(rawtx)
301-
info = node.decoderawtransaction(fundtx["hex"])
302-
return next(address for out in info["vout"]
303-
if out["value"] != dest_amount for address in out["scriptPubKey"]["addresses"])
304-
305-
306293
def submit_block_with_tx(node, tx):
307294
ctx = CTransaction()
308295
ctx.deserialize(io.BytesIO(hex_str_to_bytes(tx)))

0 commit comments

Comments
 (0)