Skip to content

Commit 62346bc

Browse files
committed
Merge bitcoin#28604: test: Use feerate higher than minrelay fee in wallet_fundraw
05af4df test: Use feerate higher than minrelay fee in wallet_fundraw (Andrew Chow) Pull request description: The external input weight test in wallet_fundrawtransaction.py made transactions at the minimum relay fee. However due to ECDSA sometimes making a shorter signature than expected, the size estimate (and therefore the funded fee) ends up being a little bit too low, which results in the final transaction being under the min relay fee. We can compensate for this by just using a feerate higher than the minrelayfee as the actual feerate itself does not matter in this test. Fixes bitcoin#28437 ACKs for top commit: glozow: utACK 05af4df, seems right to me Tree-SHA512: 3e08f052db32d891515d32b27b2d7c5bcbfc77d5ea457eefc75e8aa6d40960278e537c1e8bffe7ddc211949c78e14145a671a8d34e7e1bb15438773cb0d9e89d
2 parents db283a6 + 05af4df commit 62346bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/functional/wallet_fundrawtransaction.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,19 +1063,19 @@ def test_external_inputs(self):
10631063
high_input_weight = input_weight * 2
10641064

10651065
# Funding should also work if the input weight is provided
1066-
funded_tx = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": input_weight}])
1066+
funded_tx = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": input_weight}], fee_rate=2)
10671067
signed_tx = wallet.signrawtransactionwithwallet(funded_tx["hex"])
10681068
signed_tx = self.nodes[0].signrawtransactionwithwallet(signed_tx["hex"])
10691069
assert_equal(self.nodes[0].testmempoolaccept([signed_tx["hex"]])[0]["allowed"], True)
10701070
assert_equal(signed_tx["complete"], True)
10711071
# Reducing the weight should have a lower fee
1072-
funded_tx2 = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": low_input_weight}])
1072+
funded_tx2 = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": low_input_weight}], fee_rate=2)
10731073
assert_greater_than(funded_tx["fee"], funded_tx2["fee"])
10741074
# Increasing the weight should have a higher fee
1075-
funded_tx2 = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}])
1075+
funded_tx2 = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}], fee_rate=2)
10761076
assert_greater_than(funded_tx2["fee"], funded_tx["fee"])
10771077
# The provided weight should override the calculated weight when solving data is provided
1078-
funded_tx3 = wallet.fundrawtransaction(raw_tx, solving_data={"descriptors": [desc]}, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}])
1078+
funded_tx3 = wallet.fundrawtransaction(raw_tx, solving_data={"descriptors": [desc]}, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}], fee_rate=2)
10791079
assert_equal(funded_tx2["fee"], funded_tx3["fee"])
10801080
# The feerate should be met
10811081
funded_tx4 = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": high_input_weight}], fee_rate=10)
@@ -1085,8 +1085,8 @@ def test_external_inputs(self):
10851085
assert_fee_amount(funded_tx4["fee"], tx4_vsize, Decimal(0.0001))
10861086

10871087
# Funding with weight at csuint boundaries should not cause problems
1088-
funded_tx = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": 255}])
1089-
funded_tx = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": 65539}])
1088+
funded_tx = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": 255}], fee_rate=2)
1089+
funded_tx = wallet.fundrawtransaction(raw_tx, input_weights=[{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": 65539}], fee_rate=2)
10901090

10911091
self.nodes[2].unloadwallet("extfund")
10921092

0 commit comments

Comments
 (0)