示例#1
0
        public CallOutput EstimateGas(BlockHeader header, Transaction tx, CancellationToken cancellationToken)
        {
            EstimateGasTracer estimateGasTracer = new EstimateGasTracer();

            CallAndRestore(
                header,
                header.Number + 1,
                UInt256.Max(header.Timestamp + 1, _timestamper.EpochSeconds),
                tx,
                estimateGasTracer.WithCancellation(cancellationToken));

            long estimate = estimateGasTracer.CalculateEstimate(tx);

            return(new CallOutput {
                Error = estimateGasTracer.Error, GasSpent = estimate
            });
        }