From f93e2fbba4181aedc03df13415e5a632d65faea1 Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Mon, 4 Dec 2023 16:41:33 +0300 Subject: [PATCH] cli: use (*transaction.Transaction).HasSigner where possible No functional changes. tx.HasSigner usage to avoid code duplication. Signed-off-by: Ekaterina Pavlova --- cli/wallet/multisig.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/cli/wallet/multisig.go b/cli/wallet/multisig.go index 2065af51f..c69663da4 100644 --- a/cli/wallet/multisig.go +++ b/cli/wallet/multisig.go @@ -47,20 +47,13 @@ func signStoredTransaction(ctx *cli.Context) error { return cli.NewExitError("verifiable item is not a transaction", 1) } - signerFound := false - for i := range tx.Signers { - if tx.Signers[i].Account == ch { - signerFound = true - break - } - } - if !signerFound { + if !tx.HasSigner(acc.ScriptHash()) { return cli.NewExitError("tx signers don't contain provided account", 1) } if acc.CanSign() { sign := acc.SignHashable(pc.Network, pc.Verifiable) - if err := pc.AddSignature(ch, acc.Contract, acc.PublicKey(), sign); err != nil { + if err := pc.AddSignature(acc.ScriptHash(), acc.Contract, acc.PublicKey(), sign); err != nil { return cli.NewExitError(fmt.Errorf("can't add signature: %w", err), 1) } } else if rpcNode == "" {