diff --git a/test/functional/fundrawtransaction.py b/test/functional/fundrawtransaction.py --- a/test/functional/fundrawtransaction.py +++ b/test/functional/fundrawtransaction.py @@ -5,6 +5,7 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * +from test_framework.mininode import CTransaction, FromHex, COIN def get_unspent(listunspent, amount): @@ -652,11 +653,10 @@ rawtx, {"feeRate": 2 * min_relay_tx_fee}) result3 = self.nodes[3].fundrawtransaction( rawtx, {"feeRate": 10 * min_relay_tx_fee}) - result_fee_rate = result['fee'] * 1000 / count_bytes(result['hex']) assert_fee_amount( - result2['fee'], count_bytes(result2['hex']), 2 * result_fee_rate) + result2['fee'], FromHex(CTransaction(), result2['hex']).billable_size(), 2 * min_relay_tx_fee) assert_fee_amount( - result3['fee'], count_bytes(result3['hex']), 10 * result_fee_rate) + result3['fee'], FromHex(CTransaction(), result3['hex']).billable_size(), 10 * min_relay_tx_fee) # # Test address reuse option # diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py --- a/test/functional/test_framework/mininode.py +++ b/test/functional/test_framework/mininode.py @@ -402,6 +402,12 @@ self.sha256 = None self.hash = None + def billable_size(self): + """ + Returns the size used for billing the against the transaction + """ + return len(self.serialize()) + def serialize(self): r = b"" r += struct.pack("