Skip to content

Commit

Permalink
fix sending all amount bug
Browse files Browse the repository at this point in the history
  • Loading branch information
glossd committed Dec 26, 2021
1 parent 68f2b89 commit a1dfcc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion txutil/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func getAddressesToWithdrawFrom(params CreateParams) ([]address, error){
}
addrsToWithdrawFrom = append(addrsToWithdrawFrom, address{Address: addr, privateKey: pkInfo.key})
satoshiSum += addr.Balance
if !params.SendAll && satoshiSum > params.fullCost() {
if !params.SendAll && satoshiSum >= params.fullCost() {
return addrsToWithdrawFrom, nil
}
}
Expand Down
5 changes: 5 additions & 0 deletions wallet/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ func New(net netchain.Net) (privateKeyWif, bitcoinAddress string) {
return wif.String(), addr.EncodeAddress()
}

func NewAddress(net netchain.Net) string {
_, address := New(net)
return address
}

func check(err error) {
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit a1dfcc3

Please sign in to comment.