Skip to content

Commit

Permalink
feat(nonce): Update core_access.go adjust network nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
InoMurko authored Dec 4, 2024
1 parent c5008b6 commit 467e116
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions state/core_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (
"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,21 @@ func (ca *CoreAccessor) SubmitPayForBlob(
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 {
log.Infof("Could not parse acount sequence log")
continue
}
nonce, _ := strconv.ParseUint(numbers[0], 10, 64)
log.Infof("Adjusting nonce to %d", nonce)
ca.client.Signer().SetSequence(accName, nonce)
continue
}

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

0 comments on commit 467e116

Please sign in to comment.