Skip to content

Commit

Permalink
Added to error response for now
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Dec 24, 2020
1 parent 82c2024 commit 35940e7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package bitcoin
import (
"errors"
"fmt"
"log"
"strings"

"github.com/bitcoinsv/bsvd/bsvec"
Expand Down Expand Up @@ -112,8 +111,6 @@ 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 All @@ -127,8 +124,8 @@ func CreateTxWithChange(utxos []*Utxo, payToAddresses []*PayToAddress, opReturns
// Fee was not adjusted (all inputs do not cover the fee)
if !feeAdjusted {
return nil, fmt.Errorf(
"auto-fee could not be applied without removing an output (outputs %d) (sats %d)",
len(payToAddresses), remainder,
"auto-fee could not be applied without removing an output (payTo %d) (amount %d) (remainder %d) (fee %d) (total %d)",
len(payToAddresses), totalPayToSatoshis, remainder, fee, totalSatoshis,
)
}

Expand Down

0 comments on commit 35940e7

Please sign in to comment.