Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_node.py
Show First 20 Lines • Show All 650 Lines • ▼ Show 20 Lines | def calculate_fee(self, tx): | ||||
- all inputs are compressed-key p2pkh, and will be signed ecdsa or schnorr | - all inputs are compressed-key p2pkh, and will be signed ecdsa or schnorr | ||||
- all inputs currently unsigned (empty scriptSig) | - all inputs currently unsigned (empty scriptSig) | ||||
""" | """ | ||||
billable_size_estimate = tx.billable_size() | billable_size_estimate = tx.billable_size() | ||||
# Add some padding for signatures / public keys | # Add some padding for signatures / public keys | ||||
# 107 = length of PUSH(longest_sig = 72 bytes), PUSH(pubkey = 33 bytes) | # 107 = length of PUSH(longest_sig = 72 bytes), PUSH(pubkey = 33 bytes) | ||||
billable_size_estimate += len(tx.vin) * 107 | billable_size_estimate += len(tx.vin) * 107 | ||||
# relay_fee gives a value in BCH per kB. | # relay_fee gives a value in XEC per kB. | ||||
return int(self.relay_fee() / 1000 * billable_size_estimate * XEC) | return int(self.relay_fee() / 1000 * billable_size_estimate * XEC) | ||||
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) | ||||
def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs): | def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs): | ||||
"""Add a p2p connection to the node. | """Add a p2p connection to the node. | ||||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |