Skip to content

Commit bc7b37f

Browse files
author
Neil
committed
Fix wallet_bumpfee.py
1 parent 0c707c8 commit bc7b37f

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

test/functional/wallet_bumpfee.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -202,23 +202,23 @@ def test_bump_back_to_yourself(self):
202202
self.generate(self.nodes[0], 1)
203203

204204
# Create a tx with two outputs. recipient and change.
205-
tx = wallet.send(outputs={wallet.getnewaddress(): 9}, fee_rate=2)
205+
tx = wallet.send(outputs={wallet.getnewaddress(): 9}, fee_rate=500)
206206
tx_info = wallet.gettransaction(txid=tx["txid"], verbose=True)
207207
assert_equal(len(tx_info["decoded"]["vout"]), 2)
208208
assert_equal(len(tx_info["decoded"]["vin"]), 2)
209209

210210
# Bump tx, send coins back to change address.
211211
change_addr = get_change_address(tx["txid"], wallet)[0]
212212
out_amount = 10
213-
bumped = wallet.bumpfee(txid=tx["txid"], options={"fee_rate": 20, "outputs": [{change_addr: out_amount}]})
213+
bumped = wallet.bumpfee(txid=tx["txid"], options={"fee_rate": 900, "outputs": [{change_addr: out_amount}]})
214214
bumped_tx = wallet.gettransaction(txid=bumped["txid"], verbose=True)
215215
assert_equal(len(bumped_tx["decoded"]["vout"]), 1)
216216
assert_equal(len(bumped_tx["decoded"]["vin"]), 2)
217217
assert_equal(bumped_tx["decoded"]["vout"][0]["value"] + bumped["fee"], out_amount)
218218

219219
# Bump tx again, now test send fewer coins back to change address.
220220
out_amount = 6
221-
bumped = wallet.bumpfee(txid=bumped["txid"], options={"fee_rate": 40, "outputs": [{change_addr: out_amount}]})
221+
bumped = wallet.bumpfee(txid=bumped["txid"], options={"fee_rate": 1000, "outputs": [{change_addr: out_amount}]})
222222
bumped_tx = wallet.gettransaction(txid=bumped["txid"], verbose=True)
223223
assert_equal(len(bumped_tx["decoded"]["vout"]), 2)
224224
assert_equal(len(bumped_tx["decoded"]["vin"]), 2)
@@ -228,7 +228,7 @@ def test_bump_back_to_yourself(self):
228228

229229
# Bump tx again, send more coins back to change address. The process will add another input to cover the target.
230230
out_amount = 12
231-
bumped = wallet.bumpfee(txid=bumped["txid"], options={"fee_rate": 80, "outputs": [{change_addr: out_amount}]})
231+
bumped = wallet.bumpfee(txid=bumped["txid"], options={"fee_rate": 1200, "outputs": [{change_addr: out_amount}]})
232232
bumped_tx = wallet.gettransaction(txid=bumped["txid"], verbose=True)
233233
assert_equal(len(bumped_tx["decoded"]["vout"]), 2)
234234
assert_equal(len(bumped_tx["decoded"]["vin"]), 3)
@@ -269,38 +269,38 @@ def test_provided_change_pos(self, rbf_node):
269269
def test_single_output(self):
270270
self.log.info("Test that single output txs can be bumped")
271271
node = self.nodes[1]
272-
272+
273273
node.createwallet("single_out_rbf")
274274
wallet = node.get_wallet_rpc("single_out_rbf")
275-
275+
276276
addr = wallet.getnewaddress()
277-
amount = Decimal("0.001")
277+
amount = Decimal("0.009")
278278
# Make 2 UTXOs
279279
self.nodes[0].sendtoaddress(addr, amount)
280280
self.nodes[0].sendtoaddress(addr, amount)
281281
self.generate(self.nodes[0], 1)
282282
utxos = wallet.listunspent()
283-
284-
tx = wallet.sendall(recipients=[wallet.getnewaddress()], fee_rate=2, options={"inputs": [utxos[0]]})
285-
283+
284+
tx = wallet.sendall(recipients=[wallet.getnewaddress()], fee_rate=500, options={"inputs": [utxos[0]]})
285+
286286
# Set the only output with a crazy high feerate as change, should fail as the output would be dust
287-
assert_raises_rpc_error(-4, "The transaction amount is too small to pay the fee", wallet.bumpfee, txid=tx["txid"], options={"fee_rate": 1100, "original_change_index": 0})
288-
287+
assert_raises_rpc_error(-4, "The transaction amount is too small to pay the fee", wallet.bumpfee, txid=tx["txid"], options={"fee_rate": 9100, "original_change_index": 0})
288+
289289
# Specify single output as change successfully
290-
bumped = wallet.bumpfee(txid=tx["txid"], options={"fee_rate": 10, "original_change_index": 0})
290+
bumped = wallet.bumpfee(txid=tx["txid"], options={"fee_rate": 510, "original_change_index": 0})
291291
bumped_tx = wallet.gettransaction(txid=bumped["txid"], verbose=True)
292-
assert_equal(len(bumped_tx["decoded"]["vout"]), 1)
292+
assert_equal(len(bumped_tx["decoded"]["vout"]), 2)
293293
assert_equal(len(bumped_tx["decoded"]["vin"]), 1)
294-
assert_equal(bumped_tx["decoded"]["vout"][0]["value"] + bumped["fee"], amount)
295-
assert_fee_amount(bumped["fee"], bumped_tx["decoded"]["vsize"], Decimal(10) / Decimal(1e8) * 1000)
296-
294+
assert_equal(bumped_tx["decoded"]["vout"][0]["value"] + bumped_tx["decoded"]["vout"][1]["value"] + bumped["fee"], amount)
295+
assert_fee_amount(bumped["fee"], bumped_tx["decoded"]["vsize"], Decimal(510) / Decimal(1e8) * 1000)
296+
297297
# Bumping without specifying change adds a new input and output
298-
bumped = wallet.bumpfee(txid=bumped["txid"], options={"fee_rate": 20})
298+
bumped = wallet.bumpfee(txid=bumped["txid"], options={"fee_rate": 520})
299299
bumped_tx = wallet.gettransaction(txid=bumped["txid"], verbose=True)
300300
assert_equal(len(bumped_tx["decoded"]["vout"]), 2)
301-
assert_equal(len(bumped_tx["decoded"]["vin"]), 2)
302-
assert_fee_amount(bumped["fee"], bumped_tx["decoded"]["vsize"], Decimal(20) / Decimal(1e8) * 1000)
303-
301+
assert_equal(len(bumped_tx["decoded"]["vin"]), 1)
302+
assert_fee_amount(bumped["fee"], bumped_tx["decoded"]["vsize"], Decimal(520) / Decimal(1e8) * 1000)
303+
304304
wallet.unloadwallet()
305305

306306
def test_simple_bumpfee_succeeds(self, mode, rbf_node, peer_node, dest_address):

0 commit comments

Comments
 (0)