From 82c2024129a2b054e525993cd3280f19f43a3f4d Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Thu, 24 Dec 2020 13:20:43 -0500 Subject: [PATCH] Debugging a remainder issue --- transaction.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/transaction.go b/transaction.go index 2efd48e..56bd73a 100644 --- a/transaction.go +++ b/transaction.go @@ -3,6 +3,7 @@ package bitcoin import ( "errors" "fmt" + "log" "strings" "github.com/bitcoinsv/bsvd/bsvec" @@ -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