[#968] adm: Allow concurrent epoch ticks
All checks were successful
DCO action / DCO (pull_request) Successful in 4m10s
Vulncheck / Vulncheck (pull_request) Successful in 5m14s
Build / Build Components (1.20) (pull_request) Successful in 8m38s
Build / Build Components (1.21) (pull_request) Successful in 8m35s
Tests and linters / Tests (1.21) (pull_request) Successful in 10m56s
Tests and linters / Staticcheck (pull_request) Successful in 10m48s
Tests and linters / Tests (1.20) (pull_request) Successful in 11m11s
Tests and linters / Lint (pull_request) Successful in 11m31s
Tests and linters / Tests with -race (pull_request) Successful in 11m17s

Previous fix was incomplete, there are two possible places for this
error to occur.

Refs #592

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-02-07 19:44:28 +03:00
parent d7838790c6
commit 0a501dee81

View file

@ -37,18 +37,14 @@ func forceNewEpochCmd(cmd *cobra.Command, _ []string) error {
return err return err
} }
if err := wCtx.sendConsensusTx(bw.Bytes()); err != nil { if err = wCtx.sendConsensusTx(bw.Bytes()); err == nil {
return err err = wCtx.awaitTx()
} }
if err != nil && strings.Contains(err.Error(), "invalid epoch") {
if err := wCtx.awaitTx(); err != nil { cmd.Println("Epoch has already ticked.")
if strings.Contains(err.Error(), "invalid epoch") { return nil
cmd.Println("Epoch has already ticked.")
return nil
}
return err
} }
return nil return err
} }
func emitNewEpochCall(bw *io.BufBinWriter, wCtx *initializeContext, nmHash util.Uint160) error { func emitNewEpochCall(bw *io.BufBinWriter, wCtx *initializeContext, nmHash util.Uint160) error {