Skip to content

Commit

Permalink
Merge pull request #2 from base-org/michael/retry-ledger
Browse files Browse the repository at this point in the history
Retry ledger signature on "wallet closed" error
  • Loading branch information
mdehoog authored Jul 28, 2023
2 parents 67e16e4 + e2ae35d commit 4efb3a3
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 4efb3a3

Please sign in to comment.