Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_node.py
Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | def relay_fee(self, cached=True): | ||||
if not self.relay_fee_cache or not cached: | if not self.relay_fee_cache or not cached: | ||||
self.relay_fee_cache = self.getnetworkinfo()["relayfee"] | self.relay_fee_cache = self.getnetworkinfo()["relayfee"] | ||||
return self.relay_fee_cache | return self.relay_fee_cache | ||||
def calculate_fee(self, tx): | def calculate_fee(self, tx): | ||||
# Relay fee is in satoshis per KB. Thus the 1000, and the COIN added | # Relay fee is in satoshis per KB. Thus the 1000, and the COIN added | ||||
# to get back to an amount of satoshis. | # to get back to an amount of satoshis. | ||||
return int(self.relay_fee() / 1000 * len(ToHex(tx)) * COIN) | return int(self.relay_fee() / 1000 * tx.billable_size() * COIN) | ||||
def calculate_fee_from_txid(self, txid): | def calculate_fee_from_txid(self, txid): | ||||
ctx = FromHex(CTransaction(), self.getrawtransaction(txid)) | ctx = FromHex(CTransaction(), self.getrawtransaction(txid)) | ||||
return self.calculate_fee(ctx) | return self.calculate_fee(ctx) | ||||
class TestNodeCLI(): | class TestNodeCLI(): | ||||
"""Interface to bitcoin-cli for an individual node""" | """Interface to bitcoin-cli for an individual node""" | ||||
Show All 40 Lines |