/// <summary> /// Initialize the block observer with the wallet manager and the cross chain monitor. /// </summary> /// <param name="walletSyncManager">The wallet sync manager to pass new incoming blocks to.</param> /// <param name="depositExtractor">The component used to extract the deposits from the blocks appearing on chain.</param> /// <param name="withdrawalExtractor">The component used to extract withdrawals from blocks.</param> /// <param name="withdrawalReceiver">The component that receives the withdrawals extracted from blocks.</param> /// <param name="federationGatewayClient">Client for federation gateway api.</param> public BlockObserver(IFederationWalletSyncManager walletSyncManager, IDepositExtractor depositExtractor, IWithdrawalExtractor withdrawalExtractor, IWithdrawalReceiver withdrawalReceiver, IFederationGatewayClient federationGatewayClient, ISignals signals) { Guard.NotNull(walletSyncManager, nameof(walletSyncManager)); Guard.NotNull(federationGatewayClient, nameof(federationGatewayClient)); Guard.NotNull(depositExtractor, nameof(depositExtractor)); Guard.NotNull(withdrawalExtractor, nameof(withdrawalExtractor)); Guard.NotNull(withdrawalReceiver, nameof(withdrawalReceiver)); this.walletSyncManager = walletSyncManager; this.federationGatewayClient = federationGatewayClient; this.depositExtractor = depositExtractor; this.withdrawalExtractor = withdrawalExtractor; this.withdrawalReceiver = withdrawalReceiver; this.signals = signals; this.cancellationSource = null; this.pushBlockTipTask = null; this.signals.OnBlockConnected.Attach(this.OnBlockReceived); // TODO: Dispose with Detach ?? }
public BlockObserverTests() { this.minimumDepositConfirmations = 10; this.federationGatewaySettings = Substitute.For <IFederationGatewaySettings>(); this.federationGatewaySettings.MinimumDepositConfirmations.Returns(this.minimumDepositConfirmations); this.federationWalletSyncManager = Substitute.For <IFederationWalletSyncManager>(); this.federationGatewayClient = Substitute.For <IFederationGatewayClient>(); this.chain = Substitute.ForPartsOf <ConcurrentChain>(); this.loggerFactory = Substitute.For <ILoggerFactory>(); this.opReturnDataReader = Substitute.For <IOpReturnDataReader>(); this.consensusManager = Substitute.For <IConsensusManager>(); this.withdrawalExtractor = Substitute.For <IWithdrawalExtractor>(); this.extractedWithdrawals = TestingValues.GetWithdrawals(2); this.withdrawalExtractor.ExtractWithdrawalsFromBlock(null, 0).ReturnsForAnyArgs(this.extractedWithdrawals); this.withdrawalReceiver = Substitute.For <IWithdrawalReceiver>(); this.signals = Substitute.For <ISignals>(); this.signals.OnBlockConnected.Returns(Substitute.For <EventNotifier <ChainedHeaderBlock> >()); this.depositExtractor = new DepositExtractor( this.loggerFactory, this.federationGatewaySettings, this.opReturnDataReader); this.blockObserver = new BlockObserver( this.federationWalletSyncManager, this.depositExtractor, this.withdrawalExtractor, this.withdrawalReceiver, this.federationGatewayClient, this.signals); }
public MaturedBlocksSyncManager( IAsyncProvider asyncProvider, ICrossChainTransferStore crossChainTransferStore, IFederationGatewayClient federationGatewayClient, IFederationWalletManager federationWalletManager, IInitialBlockDownloadState initialBlockDownloadState, INodeLifetime nodeLifetime, IConversionRequestRepository conversionRequestRepository, ChainIndexer chainIndexer, Network network, IFederatedPegSettings federatedPegSettings, IFederationManager federationManager = null, IExternalApiPoller externalApiPoller = null, IConversionRequestFeeService conversionRequestFeeService = null) { this.asyncProvider = asyncProvider; this.chainIndexer = chainIndexer; this.conversionRequestRepository = conversionRequestRepository; this.crossChainTransferStore = crossChainTransferStore; this.federationGatewayClient = federationGatewayClient; this.federatedPegSettings = federatedPegSettings; this.federationWalletManager = federationWalletManager; this.initialBlockDownloadState = initialBlockDownloadState; this.nodeLifetime = nodeLifetime; this.conversionRequestRepository = conversionRequestRepository; this.chainIndexer = chainIndexer; this.externalApiPoller = externalApiPoller; this.conversionRequestFeeService = conversionRequestFeeService; this.network = network; this.federationManager = federationManager; this.logger = LogManager.GetCurrentClassLogger(); }
public MaturedBlocksSyncManager(ICrossChainTransferStore store, IFederationGatewayClient federationGatewayClient, ILoggerFactory loggerFactory) { this.store = store; this.federationGatewayClient = federationGatewayClient; this.cancellation = new CancellationTokenSource(); this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }
public MaturedBlocksSyncManagerTests() { ILoggerFactory loggerFactory = Substitute.For <ILoggerFactory>(); this.federationGatewayClient = Substitute.For <IFederationGatewayClient>(); this.crossChainTransferStore = Substitute.For <ICrossChainTransferStore>(); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.crossChainTransferStore, this.federationGatewayClient, loggerFactory); }
public MaturedBlocksSyncManager(IAsyncProvider asyncProvider, ICrossChainTransferStore crossChainTransferStore, IFederationGatewayClient federationGatewayClient, INodeLifetime nodeLifetime) { this.asyncProvider = asyncProvider; this.crossChainTransferStore = crossChainTransferStore; this.federationGatewayClient = federationGatewayClient; this.nodeLifetime = nodeLifetime; this.logger = LogManager.GetCurrentClassLogger(); }
public MaturedBlocksSyncManagerTests() { this.asyncProvider = Substitute.For <IAsyncProvider>(); this.crossChainTransferStore = Substitute.For <ICrossChainTransferStore>(); this.federationGatewayClient = Substitute.For <IFederationGatewayClient>(); ILoggerFactory loggerFactory = Substitute.For <ILoggerFactory>(); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.crossChainTransferStore, this.federationGatewayClient, loggerFactory, new NodeLifetime()); }
public MaturedBlocksSyncManager(ICrossChainTransferStore store, IFederationGatewayClient federationGatewayClient, ILoggerFactory loggerFactory, IAsyncProvider asyncProvider) { this.store = store; this.federationGatewayClient = federationGatewayClient; this.asyncProvider = asyncProvider; this.cancellation = new CancellationTokenSource(); this.logger = loggerFactory.CreateLogger("Impleum.Bitcoin.Fullnode"); }
public MaturedBlocksSyncManager(IAsyncProvider asyncProvider, ICrossChainTransferStore crossChainTransferStore, IFederationGatewayClient federationGatewayClient, ILoggerFactory loggerFactory, INodeLifetime nodeLifetime) { this.asyncProvider = asyncProvider; this.crossChainTransferStore = crossChainTransferStore; this.federationGatewayClient = federationGatewayClient; this.nodeLifetime = nodeLifetime; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }
public FederationGatewayFeature( ILoggerFactory loggerFactory, Signals signals, IDepositExtractor depositExtractor, IWithdrawalExtractor withdrawalExtractor, IWithdrawalReceiver withdrawalReceiver, IConnectionManager connectionManager, IFederationGatewaySettings federationGatewaySettings, IFullNode fullNode, IFederationWalletManager federationWalletManager, IFederationWalletSyncManager walletSyncManager, Network network, ConcurrentChain chain, INodeStats nodeStats, ICrossChainTransferStore crossChainTransferStore, IPartialTransactionRequester partialTransactionRequester, IFederationGatewayClient federationGatewayClient, MempoolManager mempoolManager, IMaturedBlocksSyncManager maturedBlocksSyncManager, IWithdrawalHistoryProvider withdrawalHistoryProvider) { this.loggerFactory = loggerFactory; this.signals = signals; this.depositExtractor = depositExtractor; this.withdrawalExtractor = withdrawalExtractor; this.withdrawalReceiver = withdrawalReceiver; this.connectionManager = connectionManager; this.federationGatewaySettings = federationGatewaySettings; this.fullNode = fullNode; this.chain = chain; this.federationWalletManager = federationWalletManager; this.walletSyncManager = walletSyncManager; this.network = network; this.crossChainTransferStore = crossChainTransferStore; this.partialTransactionRequester = partialTransactionRequester; this.federationGatewayClient = federationGatewayClient; this.mempoolManager = mempoolManager; this.maturedBlocksSyncManager = maturedBlocksSyncManager; this.withdrawalHistoryProvider = withdrawalHistoryProvider; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); // add our payload var payloadProvider = (PayloadProvider)this.fullNode.Services.ServiceProvider.GetService(typeof(PayloadProvider)); payloadProvider.AddPayload(typeof(RequestPartialTransactionPayload)); nodeStats.RegisterStats(this.AddComponentStats, StatsType.Component); nodeStats.RegisterStats(this.AddInlineStats, StatsType.Inline, 800); }
public MaturedBlocksSyncManagerTests() { this.network = new StraxTest(); this.asyncProvider = Substitute.For <IAsyncProvider>(); this.chainIndexer = new ChainIndexer(this.network); this.crossChainTransferStore = Substitute.For <ICrossChainTransferStore>(); this.federationGatewayClient = Substitute.For <IFederationGatewayClient>(); this.federationWalletManager = Substitute.For <IFederationWalletManager>(); this.federationWalletManager.WalletTipHeight.Returns(0); this.initialBlockDownloadState = Substitute.For <IInitialBlockDownloadState>(); this.initialBlockDownloadState.IsInitialBlockDownload().Returns(false); this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.chainIndexer, this.crossChainTransferStore, this.federationGatewayClient, this.federationWalletManager, this.initialBlockDownloadState, new NodeLifetime()); }
public TestOnlyMaturedBlocksSyncManager( IAsyncProvider asyncProvider, ChainIndexer chainIndexer, ICrossChainTransferStore crossChainTransferStore, IFederationGatewayClient federationGatewayClient, IFederationWalletManager federationWalletManager, IInitialBlockDownloadState initialBlockDownloadState, INodeLifetime nodeLifetime) : base( asyncProvider, crossChainTransferStore, federationGatewayClient, federationWalletManager, initialBlockDownloadState, nodeLifetime, null, chainIndexer) { }
/// <summary> /// Initialize the block observer with the wallet manager and the cross chain monitor. /// </summary> /// <param name="walletSyncManager">The wallet sync manager to pass new incoming blocks to.</param> /// <param name="depositExtractor">The component used to extract the deposits from the blocks appearing on chain.</param> /// <param name="withdrawalExtractor">The component used to extract withdrawals from blocks.</param> /// <param name="withdrawalReceiver">The component that receives the withdrawals extracted from blocks.</param> /// <param name="federationGatewayClient">Client for federation gateway api.</param> public BlockObserver(IFederationWalletSyncManager walletSyncManager, IDepositExtractor depositExtractor, IWithdrawalExtractor withdrawalExtractor, IWithdrawalReceiver withdrawalReceiver, IFederationGatewayClient federationGatewayClient) { Guard.NotNull(walletSyncManager, nameof(walletSyncManager)); Guard.NotNull(federationGatewayClient, nameof(federationGatewayClient)); Guard.NotNull(depositExtractor, nameof(depositExtractor)); Guard.NotNull(withdrawalExtractor, nameof(withdrawalExtractor)); Guard.NotNull(withdrawalReceiver, nameof(withdrawalReceiver)); this.walletSyncManager = walletSyncManager; this.federationGatewayClient = federationGatewayClient; this.depositExtractor = depositExtractor; this.withdrawalExtractor = withdrawalExtractor; this.withdrawalReceiver = withdrawalReceiver; this.cancellationSource = null; this.pushBlockTipTask = null; }
public MaturedBlocksSyncManager( IAsyncProvider asyncProvider, ICrossChainTransferStore crossChainTransferStore, IFederationGatewayClient federationGatewayClient, IFederationWalletManager federationWalletManager, IInitialBlockDownloadState initialBlockDownloadState, INodeLifetime nodeLifetime, IConversionRequestRepository conversionRequestRepository, ChainIndexer chainIndexer) { this.asyncProvider = asyncProvider; this.chainIndexer = chainIndexer; this.conversionRequestRepository = conversionRequestRepository; this.crossChainTransferStore = crossChainTransferStore; this.federationGatewayClient = federationGatewayClient; this.federationWalletManager = federationWalletManager; this.initialBlockDownloadState = initialBlockDownloadState; this.nodeLifetime = nodeLifetime; this.logger = LogManager.GetCurrentClassLogger(); }
public TestOnlyMaturedBlocksSyncManager(ICrossChainTransferStore store, IFederationGatewayClient federationGatewayClient, ILoggerFactory loggerFactory) : base(store, federationGatewayClient, loggerFactory) { }
public TestOnlyMaturedBlocksSyncManager(IAsyncProvider asyncProvider, ICrossChainTransferStore crossChainTransferStore, IFederationGatewayClient federationGatewayClient, ILoggerFactory loggerFactory, INodeLifetime nodeLifetime) : base(asyncProvider, crossChainTransferStore, federationGatewayClient, loggerFactory, nodeLifetime) { }