private void Execute(BlockReceiptsTracer tracer, Transaction tx, Block block)
 {
     tracer.StartNewBlockTrace(block);
     tracer.StartNewTxTrace(tx.Hash);
     _transactionProcessor.Execute(tx, block.Header, tracer);
     tracer.EndTxTrace();
 }
Beispiel #2
0
 public Keccak SendTransaction(Transaction transaction, bool doNotEvict = false)
 {
     transaction.Hash = Transaction.CalculateHash(transaction);
     _headBlock.Transactions[_txIndex++] = transaction;
     _receiptsTracer.StartNewTxTrace(transaction.Hash);
     _processor.Execute(transaction, Head, _receiptsTracer);
     _receiptsTracer.EndTxTrace();
     return(Transaction.CalculateHash(transaction));
 }
Beispiel #3
0
 public Keccak SendTransaction(Transaction tx, TxHandlingOptions txHandlingOptions)
 {
     tx.Hash = tx.CalculateHash();
     _headBlock.Transactions[_txIndex++] = tx;
     _receiptsTracer.StartNewTxTrace(tx.Hash);
     _processor.Execute(tx, Head, _receiptsTracer);
     _receiptsTracer.EndTxTrace();
     return(tx.CalculateHash());
 }
Beispiel #4
0
 public ValueTask <Keccak> SendTransaction(Transaction tx, TxHandlingOptions txHandlingOptions)
 {
     tx.Nonce = GetNonce(tx.SenderAddress);
     tx.Hash  = tx.CalculateHash();
     _headBlock.Transactions[_txIndex++] = tx;
     _receiptsTracer.StartNewTxTrace(tx.Hash);
     _processor.Execute(tx, Head?.Header, _receiptsTracer);
     _receiptsTracer.EndTxTrace();
     return(new ValueTask <Keccak>(tx.CalculateHash()));
 }
Beispiel #5
0
        public static void ProcessTransaction(this ITransactionProcessorAdapter transactionProcessor,
                                              Block block,
                                              Transaction currentTx,
                                              BlockReceiptsTracer receiptsTracer,
                                              ProcessingOptions processingOptions,
                                              IStateProvider stateProvider)
        {
            if (processingOptions.ContainsFlag(ProcessingOptions.DoNotVerifyNonce))
            {
                currentTx.Nonce = stateProvider.GetNonce(currentTx.SenderAddress);
            }

            receiptsTracer.StartNewTxTrace(currentTx);
            transactionProcessor.Execute(currentTx, block.Header, receiptsTracer);
            receiptsTracer.EndTxTrace();
        }
Beispiel #6
0
        private TxReceipt[] ProcessTransactions(Block block, ProcessingOptions processingOptions, IBlockTracer blockTracer)
        {
            _receiptsTracer.SetOtherTracer(blockTracer);
            _receiptsTracer.StartNewBlockTrace(block);

            for (int i = 0; i < block.Transactions.Length; i++)
            {
                Transaction currentTx = block.Transactions[i];
                if ((processingOptions & ProcessingOptions.DoNotVerifyNonce) != 0)
                {
                    currentTx.Nonce = _stateProvider.GetNonce(currentTx.SenderAddress);
                }

                _receiptsTracer.StartNewTxTrace(currentTx.Hash);
                _transactionProcessor.Execute(currentTx, block.Header, _receiptsTracer);
                _receiptsTracer.EndTxTrace();

                TransactionProcessed?.Invoke(this, new TxProcessedEventArgs(i, currentTx, _receiptsTracer.TxReceipts[i]));
            }

            return(_receiptsTracer.TxReceipts);
        }
        private TransactionReceipt[] ProcessTransactions(Block block, ProcessingOptions processingOptions, IBlockTracer blockTracer)
        {
            _receiptsTracer.SetOtherTracer(blockTracer);
            _receiptsTracer.StartNewBlockTrace(block);

            for (int i = 0; i < block.Transactions.Length; i++)
            {
                if (_logger.IsTrace)
                {
                    _logger.Trace($"Processing transaction {i}");
                }
                Transaction currentTx = block.Transactions[i];
                _receiptsTracer.StartNewTxTrace(currentTx.Hash);
                _transactionProcessor.Execute(currentTx, block.Header, _receiptsTracer);
                _receiptsTracer.EndTxTrace();

                if ((processingOptions & ProcessingOptions.ReadOnlyChain) == 0)
                {
                    TransactionProcessed?.Invoke(this, new TransactionProcessedEventArgs(_receiptsTracer.TransactionReceipts[i]));
                }
            }

            return(_receiptsTracer.TransactionReceipts);
        }