Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super speed multisg unit test #915

Merged
merged 3 commits into from
Jul 15, 2019
Merged
Changes from all commits
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
24 changes: 6 additions & 18 deletions neo.UnitTests/UT_Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Neo.VM;
using Neo.Wallets;
using Neo.Wallets.NEP6;
using System.Threading.Tasks;

namespace Neo.UnitTests
{
Expand Down Expand Up @@ -87,10 +86,10 @@ private NEP6Wallet GenerateTestWallet()
JObject wallet = new JObject();
wallet["name"] = "noname";
wallet["version"] = new System.Version().ToString();
wallet["scrypt"] = ScryptParameters.Default.ToJson();
wallet["scrypt"] = new ScryptParameters(0, 0, 0).ToJson();
wallet["accounts"] = new JArray();
wallet["extra"] = null;
wallet.ToString().Should().Be("{\"name\":\"noname\",\"version\":\"0.0\",\"scrypt\":{\"n\":16384,\"r\":8,\"p\":8},\"accounts\":[],\"extra\":null}");
wallet.ToString().Should().Be("{\"name\":\"noname\",\"version\":\"0.0\",\"scrypt\":{\"n\":0,\"r\":0,\"p\":0},\"accounts\":[],\"extra\":null}");
return new NEP6Wallet(wallet);
}

Expand All @@ -105,14 +104,8 @@ public void FeeIsMultiSigContract()
using (var unlockA = walletA.Unlock("123"))
using (var unlockB = walletB.Unlock("123"))
{
var ta = new Task<WalletAccount>(() => walletA.CreateAccount());
var tb = new Task<WalletAccount>(() => walletB.CreateAccount());
ta.Start();
tb.Start();
Task.WaitAll(ta, tb);

var a = ta.Result;
var b = tb.Result;
var a = walletA.CreateAccount();
var b = walletB.CreateAccount();

var multiSignContract = Contract.CreateMultiSigContract(2,
new ECPoint[]
Expand All @@ -121,13 +114,8 @@ public void FeeIsMultiSigContract()
b.GetKey().PublicKey
});

ta = new Task<WalletAccount>(() => walletA.CreateAccount(multiSignContract, a.GetKey()));
tb = new Task<WalletAccount>(() => walletB.CreateAccount(multiSignContract, b.GetKey()));
ta.Start();
tb.Start();
Task.WaitAll(ta, tb);

var acc = tb.Result;
walletA.CreateAccount(multiSignContract, a.GetKey());
var acc = walletB.CreateAccount(multiSignContract, b.GetKey());

// Fake balance

Expand Down