Ejemplo n.º 1
0
        public void Sets_state_root_if_provided_on_failure()
        {
            Block block = Build.A.Block.WithTransactions(MuirGlacier.Instance, Build.A.Transaction.TestObject).TestObject;

            BlockReceiptsTracer tracer = new BlockReceiptsTracer();

            tracer.SetOtherTracer(NullBlockTracer.Instance);
            tracer.StartNewBlockTrace(block);
            tracer.StartNewTxTrace(block.Transactions[0].Hash);
            tracer.MarkAsFailed(TestItem.AddressA, 100, new byte[0], "error", TestItem.KeccakF);

            Assert.AreEqual(TestItem.KeccakF, tracer.TxReceipts[0].PostTransactionState);
        }
Ejemplo n.º 2
0
        public void Invokes_other_tracer_mark_as_failed_if_other_block_tracer_is_tx_tracer_too()
        {
            Block block = Build.A.Block.WithTransactions(MuirGlacier.Instance, Build.A.Transaction.TestObject).TestObject;

            IBlockTracer        otherTracer = Substitute.For <IBlockTracer, ITxTracer>();
            BlockReceiptsTracer tracer      = new BlockReceiptsTracer();

            tracer.SetOtherTracer(otherTracer);
            tracer.StartNewBlockTrace(block);
            tracer.StartNewTxTrace(block.Transactions[0].Hash);
            tracer.MarkAsFailed(TestItem.AddressA, 100, Array.Empty <byte>(), "error", TestItem.KeccakF);

            (otherTracer as ITxTracer).Received().MarkAsFailed(TestItem.AddressA, 100, Array.Empty <byte>(), "error", TestItem.KeccakF);
        }