Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Fix invoke command #613

Merged
merged 8 commits into from
Jul 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
optimize
Luchuan committed Jun 24, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 870e4b07977df178cec61d69f4e906d67dc11b26
27 changes: 3 additions & 24 deletions neo-cli/CLI/MainService.Contracts.cs
Original file line number Diff line number Diff line change
@@ -51,35 +51,14 @@ private void OnDeployCommand(string filePath, string manifestPath = null)
[ConsoleCommand("invoke", Category = "Contract Commands")]
private void OnInvokeCommand(UInt160 scriptHash, string operation, JArray contractParameters = null, UInt160[] witnessAddress = null)
{
List<Cosigner> signCollection = new List<Cosigner>();

Cosigner[] cosigners = new Cosigner[0];
if (witnessAddress != null && !NoWallet())
{
using (SnapshotView snapshot = Blockchain.Singleton.GetSnapshot())
{
UInt160[] accounts = CurrentWallet.GetAccounts().Where(p => !p.Lock && !p.WatchOnly).Select(p => p.ScriptHash).ToArray();
foreach (var signAccount in accounts)
{
if (witnessAddress is null)
{
break;
}
foreach (var witness in witnessAddress)
{
if (witness.Equals(signAccount))
{
signCollection.Add(new Cosigner() { Account = signAccount });
break;
}
}
}
}
}
cosigners = CurrentWallet.GetAccounts().Where(p => !p.Lock && !p.WatchOnly && witnessAddress.Contains(p.ScriptHash)).Select(p => new Cosigner() { Account = p.ScriptHash }).ToArray();

Transaction tx = new Transaction
{
Sender = UInt160.Zero,
Attributes = signCollection.ToArray(),
Attributes = cosigners,
Witnesses = Array.Empty<Witness>(),
};