public void TestAddWitness() { txManager = new TransactionManager(rpcClientMock.Object, sender); // Cosigner as contract scripthash Cosigner[] cosigners = new Cosigner[1] { new Cosigner { Account = UInt160.Zero, Scopes = WitnessScope.Global } }; byte[] script = new byte[1]; txManager.MakeTransaction(script, null, cosigners); txManager.AddWitness(UInt160.Zero); txManager.AddSignature(keyPair1); txManager.Sign(); var tx = txManager.Tx; Assert.AreEqual(2, tx.Witnesses.Length); Assert.AreEqual(0, tx.Witnesses[0].VerificationScript.Length); Assert.AreEqual(0, tx.Witnesses[0].InvocationScript.Length); }
public async Task TestAddWitness() { // Cosigner as contract scripthash Signer[] signers = new Signer[2] { new Signer { Account = sender, Scopes = WitnessScope.Global }, new Signer { Account = UInt160.Zero, Scopes = WitnessScope.Global } }; byte[] script = new byte[1]; txManager = await TransactionManager.MakeTransactionAsync(rpcClientMock.Object, script, signers); txManager.AddWitness(UInt160.Zero); txManager.AddSignature(keyPair1); await txManager.SignAsync(); var tx = txManager.Tx; Assert.AreEqual(2, tx.Witnesses.Length); Assert.AreEqual(41, tx.Witnesses[0].VerificationScript.Length); Assert.AreEqual(66, tx.Witnesses[0].InvocationScript.Length); }