Ejemplo n.º 1
0
        public void TxTest(IUtxoDatabase utxoDb, IMemoryPool mempool, IConsensus consensus, ITransaction tx, bool isCoinbase)
        {
            var verifier = new TransactionVerifier(false, utxoDb, mempool, consensus);

            bool b = isCoinbase ?
                     verifier.VerifyCoinbasePrimary(tx, out string error) :
                     verifier.Verify(tx, out error);

            Assert.False(b, TxValidTests.BuildErrorStr(tx, error));
            Assert.NotNull(error);
        }
Ejemplo n.º 2
0
        public void VerifyTest(IUtxoDatabase utxoDB, IMemoryPool memPool, IConsensus c, ITransaction tx, bool expB, string expErr,
                               int expSigOp, ulong expFee, bool expSeg)
        {
            // An initial amount is set for both TotalFee and TotalSigOpCount to make sure Verify()
            // method always adds to previous values instead of setting them
            ulong initialFee   = 10;
            int   initialSigOp = 50;

            var verifier = new TransactionVerifier(false, utxoDB, memPool, c)
            {
                TotalFee        = initialFee,
                TotalSigOpCount = initialSigOp
            };

            bool actualB = verifier.Verify(tx, out string error);

            Assert.Equal(expB, actualB);
            Assert.Equal(expErr, error);
            Assert.Equal(expSigOp + initialSigOp, verifier.TotalSigOpCount);
            Assert.Equal(expFee + initialFee, verifier.TotalFee);
            Assert.Equal(expSeg, verifier.AnySegWit);
        }
Ejemplo n.º 3
0
 public void ShouldThrowWhenInputOutOfRange(int inputIndex)
 {
     Assert.ThrowsAsync <IndexOutOfRangeException>(async() => await verifier.Verify(transaction, inputIndex));
 }