From 44e21c9a8e774ce646081bb315fb61f677112e6e Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Thu, 7 Dec 2023 10:37:01 +0300 Subject: [PATCH] cli: optimize CosignersSeparator check in loops No functional changes. We have 2 exactly the same cycles,and in the 1st cycle we set cosignersOffset to the right value. So we don't need to check for arg == cmdargs.CosignersSeparator one more time. Signed-off-by: Ekaterina Pavlova --- cli/wallet/nep17.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cli/wallet/nep17.go b/cli/wallet/nep17.go index 27ef1d46c..3f8337355 100644 --- a/cli/wallet/nep17.go +++ b/cli/wallet/nep17.go @@ -535,16 +535,16 @@ func multiTransferNEP17(ctx *cli.Context) error { } var ( recipients []transferTarget - cosignersOffset = ctx.NArg() + cosignersSepPos = ctx.NArg() // `--` position. ) for i := 0; i < ctx.NArg(); i++ { arg := ctx.Args().Get(i) if arg == cmdargs.CosignersSeparator { - cosignersOffset = i + 1 + cosignersSepPos = i break } } - cosigners, extErr := cmdargs.GetSignersFromContext(ctx, cosignersOffset) + cosigners, extErr := cmdargs.GetSignersFromContext(ctx, cosignersSepPos+1) if extErr != nil { return extErr } @@ -558,11 +558,8 @@ func multiTransferNEP17(ctx *cli.Context) error { } cache := make(map[string]*wallet.Token) - for i := 0; i < cosignersOffset; i++ { + for i := 0; i < cosignersSepPos; i++ { arg := ctx.Args().Get(i) - if arg == cmdargs.CosignersSeparator { - break - } ss := strings.SplitN(arg, ":", 3) if len(ss) != 3 { return cli.NewExitError("send format must be '::", 1)