public void RewardClaimer_RetrieveSingleDeposits() { DataFolder dataFolder = TestBase.CreateDataFolder(this); var keyValueRepository = new KeyValueRepository(dataFolder, this.dbreezeSerializer); // Create a "chain" of 30 blocks. this.blocks = ChainedHeadersHelper.CreateConsecutiveHeadersAndBlocks(30, true, network: this.network, chainIndexer: this.chainIndexer, withCoinbaseAndCoinStake: true, createCirrusReward: true); using (var rewardClaimer = new RewardClaimer(this.broadCasterManager, this.chainIndexer, this.consensusManager, this.initialBlockDownloadState, keyValueRepository, this.network, this.signals)) { var depositExtractor = new DepositExtractor(this.federatedPegSettings, this.network, this.opReturnDataReader); // Add 5 distribution deposits from block 11 through to 15. for (int i = 11; i <= 15; i++) { Transaction rewardTransaction = rewardClaimer.BuildRewardTransaction(false); IDeposit deposit = depositExtractor.ExtractDepositFromTransaction(rewardTransaction, i, this.blocks[i].Block.GetHash()); Assert.NotNull(deposit); } } }
public void RewardClaimer_RetrieveBatchedDeposits() { DataFolder dataFolder = TestBase.CreateDataFolder(this); var keyValueRepository = new LevelDbKeyValueRepository(dataFolder, this.dbreezeSerializer); // Create a "chain" of 30 blocks. this.blocks = ChainedHeadersHelper.CreateConsecutiveHeadersAndBlocks(30, true, network: this.network, chainIndexer: this.chainIndexer, withCoinbaseAndCoinStake: true, createCirrusReward: true); // The reward claimer should look at block 10 to 20. using (var rewardClaimer = new RewardClaimer(this.broadCasterManager, this.chainIndexer, this.consensusManager, this.initialBlockDownloadState, keyValueRepository, this.network, this.signals)) { Transaction rewardTransaction = rewardClaimer.BuildRewardTransaction(true); Assert.Equal(10, rewardTransaction.Inputs.Count); Assert.Equal(2, rewardTransaction.Outputs.Count); Assert.Equal(Money.Coins(90), rewardTransaction.TotalOut); var depositExtractor = new DepositExtractor(this.federatedPegSettings, this.network, this.opReturnDataReader); IDeposit deposit = depositExtractor.ExtractDepositFromTransaction(rewardTransaction, 30, this.blocks[30].Block.GetHash()); Assert.Equal(Money.Coins(90), deposit.Amount); } }