Beispiel #1
0
        public void Verify_CompletelyFalse_MinerTransaction_After_First()
        {
            UInt256 val256 = UInt256.Zero;
            UInt256 merkRoot;
            UInt160 val160;
            uint    timestampVal, indexVal;
            ulong   consensusDataVal;
            Witness scriptVal;

            Transaction[] transactionsVal;
            TestUtils.SetupBlockWithValues(uut, val256, out merkRoot, out val160, out timestampVal, out indexVal, out consensusDataVal, out scriptVal, out transactionsVal, 3);

            TestUtils.SetupTestBlockchain(UInt256.Zero);

            uut.Verify(false).Should().BeFalse();
        }
Beispiel #2
0
        public void Verify_CompletelyTrue_NextConsensus_Fail()
        {
            UInt256 val256 = UInt256.Zero;
            UInt256 merkRoot;
            UInt160 val160;
            uint    timestampVal, indexVal;
            ulong   consensusDataVal;
            Witness scriptVal;

            Transaction[] transactionsVal;
            TestUtils.SetupBlockWithValues(uut, val256, out merkRoot, out val160, out timestampVal, out indexVal, out consensusDataVal, out scriptVal, out transactionsVal, 1);
            // passing NextConsensus below
            // uut.NextConsensus = new UInt160(new byte[] { 23, 52, 98, 203, 0, 206, 138, 37, 140, 16, 251, 231, 61, 120, 218, 200, 182, 125, 120, 73 });

            TestUtils.SetupTestBlockchain(UInt256.Zero);

            uut.Verify(true).Should().BeFalse();
        }
Beispiel #3
0
        private IssueTransaction getIssueTransaction(bool inputVal, decimal outputVal, UInt256 assetId)
        {
            TestUtils.SetupTestBlockchain(assetId);

            CoinReference[] inputsVal;
            if (inputVal)
            {
                inputsVal = new[]
                {
                    TestUtils.GetCoinReference(null)
                };
            }
            else
            {
                inputsVal = new CoinReference[0];
            }


            return(new IssueTransaction
            {
                Attributes = new TransactionAttribute[0],
                Inputs = inputsVal,
                Outputs = new[]
                {
                    new TransactionOutput
                    {
                        AssetId = assetId,
                        Value = Fixed8.FromDecimal(outputVal),
                        ScriptHash = Contract.CreateMultiSigRedeemScript(1, TestUtils.StandbyValidators).ToScriptHash()
                    }
                },
                Scripts = new[]
                {
                    new Witness
                    {
                        InvocationScript = new byte[0],
                        VerificationScript = new[] { (byte)OpCode.PUSHT }
                    }
                }
            });
        }
Beispiel #4
0
 public void GetScriptHashesForVerifying_Ordered()
 {
     TestUtils.SetupTestBlockchain(UInt256.Zero);
     uut = new IssueTransaction
     {
         Attributes = new TransactionAttribute[0],
         Inputs     = new CoinReference[0],
         Outputs    = new[]
         {
             new TransactionOutput
             {
                 AssetId    = Blockchain.UtilityToken.Hash,
                 Value      = Fixed8.FromDecimal(10),
                 ScriptHash = Contract.CreateMultiSigRedeemScript(1, TestUtils.StandbyValidators).ToScriptHash()
             },
             new TransactionOutput
             {
                 AssetId    = Blockchain.GoverningToken.Hash,
                 Value      = Fixed8.FromDecimal(10),
                 ScriptHash = Contract.CreateMultiSigRedeemScript(1, TestUtils.StandbyValidators).ToScriptHash()
             },
         },
         Scripts = new[]
         {
             new Witness
             {
                 InvocationScript   = new byte[0],
                 VerificationScript = new[] { (byte)OpCode.PUSHT }
             }
         }
     };
     UInt160[] res = uut.GetScriptHashesForVerifying();
     res.Length.Should().Be(2);
     res[0].Should().Be(new UInt160(TestUtils.GetByteArray(20, 0x9b)));
     res[1].Should().Be(new UInt160(TestUtils.GetByteArray(20, 0xe7)));
 }