aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Edwards <youwontforgetthis@gmail.com>2024-03-01 11:44:21 +0000
committerMax Edwards <youwontforgetthis@gmail.com>2024-03-01 11:44:21 +0000
commite67ab174c9c04bba7a10724b7e694dd57f732177 (patch)
treeb9ae82e97e0f07885033d9c94485210217adcf55
parent3c49e6967050cfc367b3c826c9eac86a48528af5 (diff)
test: fix flaky wallet_send functional test
Rather than asserting that the exact fees are the same, check the fee rate rounded to nearest interger. This will account for small differences in fees caused by variability in ECDSA signature lengths.
-rwxr-xr-xtest/functional/wallet_send.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/functional/wallet_send.py b/test/functional/wallet_send.py
index c5942578a4..580a9d2b22 100755
--- a/test/functional/wallet_send.py
+++ b/test/functional/wallet_send.py
@@ -563,6 +563,7 @@ class WalletSendTest(BitcoinTestFramework):
options={"inputs": [ext_utxo], "input_weights": [{"txid": ext_utxo["txid"], "vout": ext_utxo["vout"], "weight": 1000}]}
)
+ target_fee_rate_sat_vb = 10
# Funding should also work when input weights are provided
res = self.test_send(
from_wallet=ext_wallet,
@@ -572,14 +573,17 @@ class WalletSendTest(BitcoinTestFramework):
add_inputs=True,
psbt=True,
include_watching=True,
- fee_rate=10
+ fee_rate=target_fee_rate_sat_vb
)
signed = ext_wallet.walletprocesspsbt(res["psbt"])
signed = ext_fund.walletprocesspsbt(res["psbt"])
assert signed["complete"]
testres = self.nodes[0].testmempoolaccept([signed["hex"]])[0]
assert_equal(testres["allowed"], True)
- assert_fee_amount(testres["fees"]["base"], testres["vsize"], Decimal(0.0001))
+ actual_fee_rate_sat_vb = Decimal(testres["fees"]["base"]) * Decimal(1e8) / Decimal(testres["vsize"])
+ # Due to ECDSA signatures not always being the same length, the actual fee rate may be slightly different
+ # but rounded to nearest integer, it should be the same as the target fee rate
+ assert_equal(round(actual_fee_rate_sat_vb), target_fee_rate_sat_vb)
if __name__ == '__main__':
WalletSendTest().main()