From aba14140ecbf93741783026638aa2e066dc94960 Mon Sep 17 00:00:00 2001 From: Mark Smith Date: Mon, 26 Jul 2021 08:49:08 +0100 Subject: [PATCH] adding missing varint from p2pkh --- tx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tx.go b/tx.go index ac5ab45a..3899f334 100644 --- a/tx.go +++ b/tx.go @@ -361,8 +361,8 @@ func (tx *Tx) canAddChange(available uint64, standardFees *Fee) bool { } changeOutputFee := uint64(varIntUpper) - - changeP2pkhByteLen := 8 + 1 + 25 // 8 bytes for satoshi value +1 for varint length + 25 bytes for p2pkh script (e.g. 76a914cc...05388ac) + // 8 bytes for satoshi value +1 for varint length + 25 bytes for p2pkh script (e.g. 76a914cc...05388ac) + changeP2pkhByteLen := 8 + 1 + 25 changeOutputFee += uint64(changeP2pkhByteLen * standardFees.MiningFee.Satoshis / standardFees.MiningFee.Bytes) // not enough change to add a whole change output so don't add anything and return