diff --git a/neo-cli/CLI/MainService.Contracts.cs b/neo-cli/CLI/MainService.Contracts.cs index 7f89dd0dd..1d411108f 100644 --- a/neo-cli/CLI/MainService.Contracts.cs +++ b/neo-cli/CLI/MainService.Contracts.cs @@ -54,20 +54,19 @@ private void OnInvokeCommand(UInt160 scriptHash, string operation, JArray contra { var gas = new BigDecimal(maxGas, NativeContract.GAS.Decimals); Signer[] signers = Array.Empty(); - if (signerAccounts != null && !NoWallet()) + if (!NoWallet() && sender != null) { - if (sender != null) + if (signerAccounts == null) + signerAccounts = new UInt160[1] { sender }; + else if (signerAccounts.Contains(sender) && signerAccounts[0] != sender) { - if (signerAccounts.Contains(sender) && signerAccounts[0] != sender) - { - var signersList = signerAccounts.ToList(); - signersList.Remove(sender); - signerAccounts = signersList.Prepend(sender).ToArray(); - } - else if (!signerAccounts.Contains(sender)) - { - signerAccounts = signerAccounts.Prepend(sender).ToArray(); - } + var signersList = signerAccounts.ToList(); + signersList.Remove(sender); + signerAccounts = signersList.Prepend(sender).ToArray(); + } + else if (!signerAccounts.Contains(sender)) + { + signerAccounts = signerAccounts.Prepend(sender).ToArray(); } signers = signerAccounts.Select(p => new Signer() { Account = p, Scopes = WitnessScope.CalledByEntry }).ToArray(); }