예제 #1
0
 public BlockNotificationFeature(BlockNotification blockNotification, BlockNotificationStartHash blockNotificationStartHash,
                                 FullNode.CancellationProvider cancellationProvider)
 {
     this.blockNotification    = blockNotification;
     this.startHash            = blockNotificationStartHash.StartHash;
     this.cancellationProvider = cancellationProvider;
 }
예제 #2
0
        public PosMinting(ConsensusLoop consensusLoop, ConcurrentChain chain, Network network, ConnectionManager connection,
                          IDateTimeProvider dateTimeProvider, AssemblerFactory blockAssemblerFactory, BlockRepository blockRepository,
                          BlockStore.ChainBehavior.ChainState chainState, Signals signals, FullNode.CancellationProvider cancellationProvider,
                          NodeSettings settings, CoinView coinView, StakeChain stakeChain)
        {
            this.consensusLoop         = consensusLoop;
            this.chain                 = chain;
            this.network               = network;
            this.connection            = connection;
            this.dateTimeProvider      = dateTimeProvider;
            this.blockAssemblerFactory = blockAssemblerFactory;
            this.blockRepository       = blockRepository;
            this.chainState            = chainState;
            this.signals               = signals;
            this.cancellationProvider  = cancellationProvider;
            this.settings              = settings;
            this.coinView              = coinView;
            this.stakeChain            = stakeChain;

            this.minerSleep = 500;                                                                          // GetArg("-minersleep", 500);
            this.lastCoinStakeSearchTime = Utils.DateTimeToUnixTime(this.dateTimeProvider.GetTimeOffset()); // startup timestamp
            this.reserveBalance          = 0;                                                               // TOOD:settings.ReserveBalance
            this.minimumInputValue       = 0;

            this.posConsensusValidator = consensusLoop.Validator as PosConsensusValidator;
        }
 public BlockNotificationFeature(BlockNotification blockNotification, FullNode.CancellationProvider cancellationProvider, ConnectionManager connectionManager, LookaheadBlockPuller blockPuller, ChainBehavior.ChainState chainState, ConcurrentChain chain)
 {
     this.blockNotification    = blockNotification;
     this.cancellationProvider = cancellationProvider;
     this.connectionManager    = connectionManager;
     this.blockPuller          = blockPuller;
     this.chainState           = chainState;
     this.chain = chain;
 }
예제 #4
0
 public LightWalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain, Network network,
                               BlockNotification blockNotification, Signals signals, FullNode.CancellationProvider cancellationProvider)
 {
     this.walletManager        = walletManager as WalletManager;
     this.chain                = chain;
     this.signals              = signals;
     this.blockNotification    = blockNotification;
     this.coinType             = (CoinType)network.Consensus.CoinType;
     this.logger               = loggerFactory.CreateLogger(this.GetType().FullName);
     this.cancellationProvider = cancellationProvider;
 }
예제 #5
0
 public LightWalletFeature(IWalletSyncManager walletSyncManager, IWalletManager walletManager, IConnectionManager connectionManager,
                           ConcurrentChain chain, NodeDeployments nodeDeployments, IAsyncLoopFactory asyncLoopFactory, FullNode.CancellationProvider cancellationProvider)
 {
     this.walletSyncManager    = walletSyncManager;
     this.walletManager        = walletManager;
     this.connectionManager    = connectionManager;
     this.chain                = chain;
     this.nodeDeployments      = nodeDeployments;
     this.asyncLoopFactory     = asyncLoopFactory;
     this.cancellationProvider = cancellationProvider;
 }
예제 #6
0
        public void BlockNotificationFeatureCallsNotifyOnStart()
        {
            var cancellationProvider = new FullNode.CancellationProvider
            {
                Cancellation = new CancellationTokenSource()
            };
            var blockNotification = new Mock <BlockNotification>(new ConcurrentChain(), new BlockPullerStub(), new Signals());

            var blockNotificationFeature = new BlockNotificationFeature(blockNotification.Object, new BlockNotificationStartHash(0), cancellationProvider);

            blockNotificationFeature.Start();

            blockNotification.Verify(notif => notif.Notify(0, cancellationProvider.Cancellation.Token), Times.Once);
        }
예제 #7
0
 public PowMining(ConsensusLoop consensusLoop, ConcurrentChain chain, Network network,
                  IDateTimeProvider dateTimeProvider, AssemblerFactory blockAssemblerFactory, BlockRepository blockRepository,
                  BlockStore.ChainBehavior.ChainState chainState, Signals signals, FullNode.CancellationProvider cancellationProvider)
 {
     this.consensusLoop         = consensusLoop;
     this.chain                 = chain;
     this.network               = network;
     this.dateTimeProvider      = dateTimeProvider;
     this.blockAssemblerFactory = blockAssemblerFactory;
     this.blockRepository       = blockRepository;
     this.chainState            = chainState;
     this.signals               = signals;
     this.cancellationProvider  = cancellationProvider;
 }
 public BlockStoreFeature(ConcurrentChain chain, ConnectionManager connectionManager, Signals signals, BlockRepository blockRepository,
                          BlockStoreCache blockStoreCache, StoreBlockPuller blockPuller, BlockStoreLoop blockStoreLoop, BlockStoreManager blockStoreManager,
                          BlockStoreSignaled blockStoreSignaled, FullNode.CancellationProvider cancellationProvider)
 {
     this.chain                = chain;
     this.signals              = signals;
     this.blockRepository      = blockRepository;
     this.blockStoreCache      = blockStoreCache;
     this.blockPuller          = blockPuller;
     this.blockStoreLoop       = blockStoreLoop;
     this.blockStoreManager    = blockStoreManager;
     this.blockStoreSignaled   = blockStoreSignaled;
     this.cancellationProvider = cancellationProvider;
     this.connectionManager    = connectionManager;
 }
예제 #9
0
        public void BlockNotificationFeatureCallsNotifyOnStart()
        {
            var cancellationProvider = new FullNode.CancellationProvider
            {
                Cancellation = new CancellationTokenSource()
            };

            var connectionManager = new Mock <ConnectionManager>(Network.Main, new Mock <NodeConnectionParameters>().Object, new Mock <NodeSettings>().Object);
            var chain             = new Mock <ConcurrentChain>();
            var chainState        = new Mock <ChainBehavior.ChainState>(new Mock <FullNode>().Object);
            var blockPuller       = new Mock <LookaheadBlockPuller>(chain.Object, connectionManager.Object);
            var blockNotification = new Mock <BlockNotification>(chain.Object, blockPuller.Object, new Signals());

            var blockNotificationFeature = new BlockNotificationFeature(blockNotification.Object, cancellationProvider, connectionManager.Object, blockPuller.Object, chainState.Object, chain.Object);

            blockNotificationFeature.Start();

            blockNotification.Verify(notif => notif.Notify(cancellationProvider.Cancellation.Token), Times.Once);
        }
 public BaseFeature(
     NodeSettings nodeSettings,                          //node settings
     DataFolder dataFolder,                              //data folders
     Network network,                                    //network (regtest/testnet/default)
     FullNode.CancellationProvider cancellationProvider, //trigger when to dispose resources because of a global cancellation
     ConcurrentChain chain,
     BlockStore.ChainBehavior.ChainState chainState,
     ConnectionManager connectionManager,
     ChainRepository chainRepository)
 {
     this.chainState           = Guard.NotNull(chainState, nameof(chainState));
     this.chainRepository      = Guard.NotNull(chainRepository, nameof(chainRepository));
     this.nodeSettings         = Guard.NotNull(nodeSettings, nameof(nodeSettings));
     this.dataFolder           = Guard.NotNull(dataFolder, nameof(dataFolder));
     this.network              = Guard.NotNull(network, nameof(network));
     this.cancellationProvider = Guard.NotNull(cancellationProvider, nameof(cancellationProvider));
     this.chain             = Guard.NotNull(chain, nameof(chain));
     this.connectionManager = Guard.NotNull(connectionManager, nameof(connectionManager));
 }
 public MempoolSignaled(MempoolManager manager, ConcurrentChain chain, ConnectionManager connection, FullNode.CancellationProvider cancellationProvider)
 {
     this.manager    = manager;
     this.chain      = chain;
     this.connection = connection;
     this.RelayWorker(cancellationProvider.Cancellation.Token);
 }