Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nonce): Update core_access.go adjust network nonce #3980

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions state/core_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"fmt"
"sync"
"time"
"strings"
"regexp"
"strconv"

nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand Down Expand Up @@ -267,6 +270,20 @@
continue
}

//https://github.com/celestiaorg/celestia-app/pull/4067 ?
if err != nil && strings.Contains(err.Error(), "incorrect account sequence") {
regexpInt := regexp.MustCompile(`[0-9]+`)
numbers := regexpInt.FindAllString(err.Error(), -1)
log.Infof("Received nonce correction message from the network %w", err.Error())
if len(numbers) != 2 {
return nil, fmt.Errorf("unexpected wrong sequence error: %w", err)
}
nonce, _ := strconv.ParseUint(numbers[0], 10, 64)
log.Infof("Adjusting nonce to %d", nonce)
ca.client.Signer().SetSequence(accName, nonce)

Check failure on line 283 in state/core_access.go

View workflow job for this annotation

GitHub Actions / go-ci / Lint

Error return value of `(*github.com/celestiaorg/celestia-app/v3/pkg/user.Signer).SetSequence` is not checked (errcheck)
continue
}

if err != nil {
return nil, err
}
Expand Down
Loading