Skip to content

Commit

Permalink
Debugging a remainder issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Dec 24, 2020
1 parent e89cd27 commit 82c2024
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bitcoin
import (
"errors"
"fmt"
"log"
"strings"

"github.com/bitcoinsv/bsvd/bsvec"
Expand Down Expand Up @@ -111,6 +112,8 @@ func CreateTxWithChange(utxos []*Utxo, payToAddresses []*PayToAddress, opReturns
// Get the remainder missing
remainder := (totalPayToSatoshis + fee) - totalSatoshis

log.Println(fee, totalPayToSatoshis, remainder, totalSatoshis)

// Remove remainder from last used payToAddress (or continue until found)
feeAdjusted := false
for i := len(payToAddresses) - 1; i >= 0; i-- { // Working backwards
Expand Down

0 comments on commit 82c2024

Please sign in to comment.