From c32dfff0a71e5ef5719a7a96938e3f5f5115b513 Mon Sep 17 00:00:00 2001 From: Mark Smith Date: Mon, 26 Jul 2021 08:45:06 +0100 Subject: [PATCH] adding missing varint on changeP2pkhByteLen --- tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tx.go b/tx.go index 2b75a73a..ac5ab45a 100644 --- a/tx.go +++ b/tx.go @@ -362,7 +362,7 @@ func (tx *Tx) canAddChange(available uint64, standardFees *Fee) bool { changeOutputFee := uint64(varIntUpper) - changeP2pkhByteLen := 8 + 25 // 8 bytes for satoshi value + 25 bytes for p2pkh script (e.g. 76a914cc...05388ac) + changeP2pkhByteLen := 8 + 1 + 25 // 8 bytes for satoshi value +1 for varint length + 25 bytes for p2pkh script (e.g. 76a914cc...05388ac) 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