diff --git a/test/functional/bip68-sequence.py b/test/functional/bip68-sequence.py --- a/test/functional/bip68-sequence.py +++ b/test/functional/bip68-sequence.py @@ -287,7 +287,7 @@ # Mine tx2, and then try again self.nodes[0].prioritisetransaction( - tx2.hash, 1e15, int(self.relayfee * COIN)) + tx2.hash, 1e15, self.nodes[0].calculate_fee(tx2)) # Advance the time on the node so that we can test timelocks self.nodes[0].setmocktime(cur_time + 600) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -13,6 +13,7 @@ import subprocess import time +from .mininode import COIN, ToHex from .util import ( assert_equal, get_rpc_proxy, @@ -64,6 +65,7 @@ self.rpc_connected = False self.rpc = None self.url = None + self.relay_fee_cache = None self.log = logging.getLogger('TestFramework.node%d' % i) def __getattr__(self, *args, **kwargs): @@ -156,6 +158,15 @@ self.encryptwallet(passphrase) self.wait_until_stopped() + def relay_fee(self, cached=True): + if not self.relay_fee_cache or not cached: + self.relay_fee_cache = self.getnetworkinfo()["relayfee"] + + return self.relay_fee_cache + + def calculate_fee(self, tx): + return int(self.relay_fee() * len(ToHex(tx)) * COIN) + class TestNodeCLI(): """Interface to bitcoin-cli for an individual node"""