Skip to content

Commit

Permalink
Clearer errors for unopened accountts
Browse files Browse the repository at this point in the history
  • Loading branch information
bbedward committed Jul 10, 2024
1 parent d972338 commit 8cb51c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/wallet/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ func (w *NanoWallet) createSendBlock(wallet *ent.Wallet, sender *ent.Account, am

// Get account info
accountInfo, err := w.RpcClient.MakeAccountInfoRequest(sender.Address)
if errors.Is(err, nanorpc.ErrAccountNotFound) && w.Config.Wallet.AutoReceiveOnSend != nil && *w.Config.Wallet.AutoReceiveOnSend {
if errors.Is(err, ErrAccountNotFound) {
if w.Config.Wallet.AutoReceiveOnSend == nil || !*w.Config.Wallet.AutoReceiveOnSend {
return nil, ErrInsufficientBalance
}
// See if account has a pending balance to open the accountt
bal, err := w.RpcClient.MakeAccountBalanceRequest(sender.Address)
if err != nil {
Expand Down

0 comments on commit 8cb51c9

Please sign in to comment.