Skip to content

Commit

Permalink
[FIX] More Python2 rounding problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mccwdev committed Jan 12, 2020
1 parent 4b076c3 commit 4cd288a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bitcoinlib/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3557,7 +3557,7 @@ def transaction_import(self, t):
rt.vsize = t.vsize
if not t.vsize:
rt.vsize = rt.size
rt.fee_per_kb = int((rt.fee / rt.size) * 1024)
rt.fee_per_kb = int((rt.fee / float(rt.size)) * 1024)
rt.block_height = t.block_height
rt.confirmations = t.confirmations
rt.witness_type = t.witness_type
Expand Down Expand Up @@ -3601,7 +3601,7 @@ def transaction_import_raw(self, raw_tx, network=None):
rt = self.transaction_create(t_import.outputs, t_import.inputs, network=network)
rt.verify()
rt.size = rt.vsize = len(raw_tx)
rt.fee_per_kb = int((rt.fee / rt.size) * 1024)
rt.fee_per_kb = int((rt.fee / float(rt.size)) * 1024)
return rt

def send(self, output_arr, input_arr=None, input_key_id=None, account_id=None, network=None, fee=None,
Expand Down Expand Up @@ -3658,7 +3658,7 @@ def send(self, output_arr, input_arr=None, input_key_id=None, account_id=None, n
if fee is None and transaction.fee_per_kb and transaction.change:
fee_exact = transaction.calculate_fee()
# Recreate transaction if fee estimation more then 10% off
if fee_exact and abs((transaction.fee - fee_exact) / float(fee_exact)) > 0.10:
if fee_exact and abs((float(transaction.fee) - float(fee_exact)) / float(fee_exact)) > 0.10:
_logger.info("Transaction fee not correctly estimated (est.: %d, real: %d). "
"Recreate transaction with correct fee" % (transaction.fee, fee_exact))
transaction = self.transaction_create(output_arr, input_arr, input_key_id, account_id, network,
Expand Down

0 comments on commit 4cd288a

Please sign in to comment.