Exemple #1
0
        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 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());
        }
Exemple #3
0
        public async Task NodeIsInIBD_DelayRequiredAsync()
        {
            this.initialBlockDownloadState = Substitute.For <IInitialBlockDownloadState>();
            this.initialBlockDownloadState.IsInitialBlockDownload().Returns(true);
            this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.chainIndexer, this.crossChainTransferStore, this.federationGatewayClient, this.federationWalletManager, this.initialBlockDownloadState, new NodeLifetime());

            bool delayRequired = await this.syncManager.ExposedSyncBatchOfBlocksAsync();

            Assert.True(delayRequired);
        }
        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());
        }
Exemple #5
0
        public async Task FederationWalletIsSyncing_DelayRequiredAsync()
        {
            this.initialBlockDownloadState = Substitute.For <IInitialBlockDownloadState>();
            this.initialBlockDownloadState.IsInitialBlockDownload().Returns(false);

            // Create chain of 15 blocks
            var          testbase = new TestBase(this.network);
            List <Block> blocks   = new TestBase(this.network).CreateBlocks(15);

            testbase.AppendBlocksToChain(this.chainIndexer, blocks);

            this.federationWalletManager = Substitute.For <IFederationWalletManager>();
            this.federationWalletManager.WalletTipHeight.Returns(0);

            this.syncManager = new TestOnlyMaturedBlocksSyncManager(this.asyncProvider, this.chainIndexer, this.crossChainTransferStore, this.federationGatewayClient, this.federationWalletManager, this.initialBlockDownloadState, new NodeLifetime());

            bool delayRequired = await this.syncManager.ExposedSyncBatchOfBlocksAsync();

            Assert.True(delayRequired);
        }