Skip to content

Commit

Permalink
Retry ledger signature on "wallet closed" error
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Jul 28, 2023
1 parent 67e16e4 commit e2ae35d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ func main() {
fmt.Printf("Data sent to ledger, awaiting signature...")
}
signature, err := s.sign(hash)
if err == accounts.ErrWalletClosed {
// ledger is flaky sometimes, recreate and retry
fmt.Printf("failed with %s, retrying...", err.Error())
s, err = createSigner(privateKey, mnemonic, hdPath)
if err != nil {
log.Fatalf("Error creating signer: %v", err)
}
signature, err = s.sign(hash)
}
if ledger {
fmt.Println("done")
}
Expand Down

0 comments on commit e2ae35d

Please sign in to comment.