Beispiel #1
0
        private void ApplyMinerRewards(Block block, IBlockTracer tracer)
        {
            if (_logger.IsTrace)
            {
                _logger.Trace("Applying miner rewards:");
            }
            var rewards = _rewardCalculator.CalculateRewards(block);

            for (int i = 0; i < rewards.Length; i++)
            {
                BlockReward reward = rewards[i];

                ITxTracer txTracer = null;
                if (tracer.IsTracingRewards)
                {
                    txTracer = tracer.StartNewTxTrace(null);
                }

                ApplyMinerReward(block, reward, tracer.IsTracingRewards ? tracer : NullBlockTracer.Instance);

                if (tracer.IsTracingRewards)
                {
                    tracer.EndTxTrace();
                    tracer.ReportReward(reward.Address, reward.RewardType.ToLowerString(), (UInt256)reward.Value);
                    if (txTracer?.IsTracingState ?? false)
                    {
                        _stateProvider.Commit(_specProvider.GetSpec(block.Number), txTracer);
                    }
                }
            }
        }
Beispiel #2
0
        // TODO: block processor pipeline
        private void ApplyMinerRewards(Block block, IBlockTracer tracer, IReleaseSpec spec)
        {
            if (_logger.IsTrace)
            {
                _logger.Trace("Applying miner rewards:");
            }
            BlockReward[] rewards = _rewardCalculator.CalculateRewards(block);
            for (int i = 0; i < rewards.Length; i++)
            {
                BlockReward reward = rewards[i];

                ITxTracer txTracer = NullTxTracer.Instance;
                if (tracer.IsTracingRewards)
                {
                    // we need this tracer to be able to track any potential miner account creation
                    txTracer = tracer.StartNewTxTrace(null);
                }

                ApplyMinerReward(block, reward, spec);

                if (tracer.IsTracingRewards)
                {
                    tracer.EndTxTrace();
                    tracer.ReportReward(reward.Address, reward.RewardType.ToLowerString(), reward.Value);
                    if (txTracer.IsTracingState)
                    {
                        _stateProvider.Commit(spec, txTracer);
                    }
                }
            }
        }
Beispiel #3
0
        private void ApplyMinerRewards(Block block, IBlockTracer tracer)
        {
            if (_logger.IsTrace)
            {
                _logger.Trace("Applying miner rewards:");
            }
            var rewards = _rewardCalculator.CalculateRewards(block);

            for (int i = 0; i < rewards.Length; i++)
            {
                BlockReward reward = rewards[i];

                ITxTracer txTracer = null;
                if (tracer.IsTracingRewards)
                {
                    // we need this tracer to be able to track any potential miner account creation
                    txTracer = tracer.StartNewTxTrace(null);
                }

                ApplyMinerReward(block, reward);

                if (tracer.IsTracingRewards)
                {
                    tracer.EndTxTrace();
                    tracer.ReportReward(reward.Address, reward.RewardType.ToLowerString(), reward.Value);
                    if (txTracer?.IsTracingState ?? false)
                    {
                        _stateProvider.Commit(_specProvider.GetSpec(block.Number), txTracer);
                    }
                }
            }
        }
Beispiel #4
0
        public ITxTracer StartNewTxTrace(Transaction?tx)
        {
            IList <IBlockTracer> childBlockTracers = _childTracers;

            List <ITxTracer> tracers = new(childBlockTracers.Count);

            for (int i = 0; i < childBlockTracers.Count; i++)
            {
                IBlockTracer childBlockTracer = childBlockTracers[i];
                ITxTracer    txTracer         = childBlockTracer.StartNewTxTrace(tx);
                if (txTracer != NullTxTracer.Instance)
                {
                    tracers.Add(txTracer);
                }
            }

            return(tracers.Count > 0 ? new CompositeTxTracer(tracers) : NullTxTracer.Instance);
        }
 public ITxTracer StartNewTxTrace(Keccak txHash)
 {
     _currentTxTracer = _otherTracer.StartNewTxTrace(txHash);
     return(_currentTxTracer);
 }