示例#1
0
        public void UpdateHeaders_UsingChainAndNetwork_PreparesBlockHeaders()
        {
            this.ExecuteWithConsensusOptions(new PowConsensusOptions(), () =>
            {
                this.dateTimeProvider.Setup(d => d.GetTimeOffset())
                .Returns(new DateTimeOffset(new DateTime(2017, 1, 7, 0, 0, 0, DateTimeKind.Utc)));

                var chain = GenerateChainWithHeight(5, this.network, new Key(), new Target(235325239));

                var powBlockAssembler = new PowTestBlockAssembler(this.consensusLoop.Object, this.network, new MempoolSchedulerLock(), this.txMempool.Object,
                                                                  this.dateTimeProvider.Object, chain.Tip, this.LoggerFactory.Object);

                var result = powBlockAssembler.UpdateHeaders(chain.Tip);

                Assert.Equal(chain.Tip.HashBlock, result.Header.HashPrevBlock);
                Assert.Equal((uint)1483747200, result.Header.Time);
                Assert.Equal(1.9610088966776103E+35, result.Header.Bits.Difficulty);
                Assert.Equal((uint)0, result.Header.Nonce);
            });
        }