[#968] adm: Allow concurrent epoch ticks

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 committed by Evgenii Stratonikov
parent cfc5ce7853
commit 053a195ac2

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 {