Exemplo n.º 1
0
        public SynchronizationProcessor(ILogger <SynchronizationProcessor> logger,
                                        IEventBus eventBus,
                                        IDateTimeProvider dateTimeProvider,
                                        IPeerBehaviorManager peerBehaviorManager,
                                        IConsensusParameters consensusParameters,
                                        IInitialBlockDownloadTracker ibdState,
                                        IBlockHeaderHashCalculator blockHeaderHashCalculator,
                                        ITransactionHashCalculator transactionHashCalculator,
                                        IBlockFetcherManager blockFetcherManager,
                                        ILocalServiceProvider localServiceProvider,
                                        IChainState chainState,
                                        IHeaderValidator headerValidator,
                                        IBlockValidator blockValidator,
                                        IPeriodicWork headerSyncLoop,
                                        IOptions <BitcoinSettings> options)
            : base(logger, eventBus, peerBehaviorManager, isHandshakeAware: true, receiveMessagesOnlyIfHandshaked: true)
        {
            _dateTimeProvider          = dateTimeProvider;
            _consensusParameters       = consensusParameters;
            _ibdState                  = ibdState;
            _blockHeaderHashCalculator = blockHeaderHashCalculator;
            _transactionHashCalculator = transactionHashCalculator;
            _blockFetcherManager       = blockFetcherManager;
            _localServiceProvider      = localServiceProvider;
            _chainState                = chainState;
            _headerValidator           = headerValidator;
            _blockValidator            = blockValidator;
            _headerSyncLoop            = headerSyncLoop;
            _options = options.Value;


            _minimumChainWork = _options.MinimumChainWork ?? _consensusParameters.MinimumChainWork;
            if (_minimumChainWork < _consensusParameters.MinimumChainWork)
            {
                this.logger.LogWarning($"{nameof(_minimumChainWork)} set below default value of {_consensusParameters.MinimumChainWork}");
            }

            headerSyncLoop.Configure(stopOnException: false, this);
        }
 public BitcoinRegtestDefinition(IBlockHeaderHashCalculator blockHeaderHashCalculator) : base(blockHeaderHashCalculator)
 {
 }
Exemplo n.º 3
0
        public BitcoinChain(IBlockHeaderHashCalculator blockHeaderHashCalculator)
        {
            _blockHeaderHashCalculator = blockHeaderHashCalculator;

            Initialize();
        }