mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
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 <ekt@morphbits.io>
This commit is contained in:
parent
8bdbac3c5e
commit
44e21c9a8e
1 changed files with 4 additions and 7 deletions
|
@ -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 '<token>:<addr>:<amount>", 1)
|
||||
|
|
Loading…
Reference in a new issue