Skip to content

Commit

Permalink
Merge JoinMarket-Org#1596: Fix one off bug in tx vsize calculation in…
Browse files Browse the repository at this point in the history
… some cases

4486b10 Transaction virtual size must be rounded upwards (Kristaps Kaupe)

Pull request description:

  Transaction virtual size must be rounded upwards.

Top commit has no ACKs.

Tree-SHA512: 9541ec8754d48aacdc10dc0cfb4323b60c4514f8f61a2d827ee7354d58cf46db530b4b68850f450a58e2053a9f69504fd80ca9f4d3614b7df24bc8d38f09a7fe
  • Loading branch information
kristapsk committed Nov 13, 2023
2 parents c8f90a4 + 4486b10 commit 536ddad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/jmbitcoin/secp256k1_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# needed for single sha256 evaluation, which is used
# in bitcoin (p2wsh) but not exposed in python-bitcointx:
import hashlib
from math import ceil

from jmbitcoin.secp256k1_main import *
from jmbase import bintohex, utxo_to_utxostr
Expand Down Expand Up @@ -181,7 +182,7 @@ def tx_vsize(tx):
raw_tx_size = len(tx.serialize())
witness_size = len(tx.wit.serialize())
non_witness_size = raw_tx_size - witness_size
return int(non_witness_size + .25 * witness_size)
return ceil(non_witness_size + .25 * witness_size)

def pubkey_to_p2pkh_script(pub, require_compressed=False):
"""
Expand Down

0 comments on commit 536ddad

Please sign in to comment.