Skip to content

Commit

Permalink
adding missing varint on changeP2pkhByteLen
Browse files Browse the repository at this point in the history
  • Loading branch information
theflyingcodr committed Jul 26, 2021
1 parent 4445010 commit c32dfff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c32dfff

Please sign in to comment.