Skip to content

Commit 6cb10c1

Browse files
author
MarcoFalke
committed
Merge #17199: test: use default address type (bech32) for wallet_bumpfee tests
8d8e5a7 test: use default address type (bech32) for wallet_bumpfee tests (Sebastian Falbesoner) Pull request description: The use of native segwit addresses (pure p2wpkh instead of p2sh-p2wpkh) leads to smaller transaction sizes, needing adaption of some constants in the following test cases: - `test_dust_to_fee()`: adaption of dust calculation (p2wpkh spend estimate of 67 is taken from `src/policy/policy.cpp:GetDustThreshold()`) - `test_maxtxfee_fails()`: lowering `-maxtxfee` setting to trigger fail Top commit has no ACKs. Tree-SHA512: b4163700d56c11955f811bc5fe6edaf7aec69931d7db741c03b055fb518bb9825c031fb931c513b37a1968085cb8c2f263adf664b357aff8ee42795fd0f88d2d
2 parents 8f9df2e + 8d8e5a7 commit 6cb10c1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/functional/wallet_bumpfee.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def set_test_params(self):
3838
"-walletrbf={}".format(i),
3939
"-mintxfee=0.00002",
4040
"-deprecatedrpc=totalFee",
41-
"-addresstype=p2sh-segwit", # TODO update constants in test and remove
41+
"-addresstype=bech32",
4242
] for i in range(self.num_nodes)]
4343

4444
def skip_test_if_missing_module(self):
@@ -246,10 +246,8 @@ def test_dust_to_fee(rbf_node, dest_address):
246246
# the bumped tx sets fee=49,900, but it converts to 50,000
247247
rbfid = spend_one_input(rbf_node, dest_address)
248248
fulltx = rbf_node.getrawtransaction(rbfid, 1)
249-
# (32-byte p2sh-pwpkh output size + 148 p2pkh spend estimate) * 10k(discard_rate) / 1000 = 1800
250-
# P2SH outputs are slightly "over-discarding" due to the IsDust calculation assuming it will
251-
# be spent as a P2PKH.
252-
bumped_tx = rbf_node.bumpfee(rbfid, {"totalFee": 50000 - 1800})
249+
# (31-vbyte p2wpkh output size + 67-vbyte p2wpkh spend estimate) * 10k(discard_rate) / 1000 = 980
250+
bumped_tx = rbf_node.bumpfee(rbfid, {"totalFee": 50000 - 980})
253251
full_bumped_tx = rbf_node.getrawtransaction(bumped_tx["txid"], 1)
254252
assert_equal(bumped_tx["fee"], Decimal("0.00050000"))
255253
assert_equal(len(fulltx["vout"]), 2)
@@ -272,7 +270,9 @@ def test_settxfee(rbf_node, dest_address):
272270

273271

274272
def test_maxtxfee_fails(test, rbf_node, dest_address):
275-
test.restart_node(1, ['-maxtxfee=0.00003'] + test.extra_args[1])
273+
# size of bumped transaction (p2wpkh, 1 input, 2 outputs): 141 vbytes
274+
# expected bumping feerate of 20 sats/vbyte => 141*20 sats = 0.00002820 btc
275+
test.restart_node(1, ['-maxtxfee=0.000025'] + test.extra_args[1])
276276
rbf_node.walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
277277
rbfid = spend_one_input(rbf_node, dest_address)
278278
assert_raises_rpc_error(-4, "Unable to create transaction: Fee exceeds maximum configured by -maxtxfee", rbf_node.bumpfee, rbfid)

0 commit comments

Comments
 (0)