Beispiel #1
0
        /// <summary>
        /// Allow the processor to resume from where it left off
        /// </summary>
        private async Task <BigInteger> GetStartingBlockNumber()
        {
            _log.GettingLastBlockProcessed();
            var lastBlockProcessed = await _strategy.GetLastBlockProcessedAsync()
                                     .ConfigureAwait(false);

            _log.LastBlockProcessed(lastBlockProcessed);

            BigInteger startingBlock = lastBlockProcessed == null ? 0 : lastBlockProcessed.Value + 1;

            return(_strategy.MinimumBlockNumber > startingBlock ? _strategy.MinimumBlockNumber : startingBlock);
        }
Beispiel #2
0
        /// <summary>
        /// Allow the processor to resume from where it left off
        /// </summary>
        private async Task <long> GetStartingBlockNumber()
        {
            _log.LogInformation("Begin GetStartingBlockNumber / _strategy.GetLastBlockProcessedAsync()");
            var blockNumber = await _strategy.GetLastBlockProcessedAsync();

            _log.LogInformation($"GetLastBlockProcessedAsync: {blockNumber}");

            blockNumber = blockNumber <= 0 ? 0 : blockNumber - 1;

            if (_strategy.MinimumBlockNumber > blockNumber)
            {
                return(_strategy.MinimumBlockNumber);
            }

            return(blockNumber);
        }