public void CreateCoinbase_CreatesCoinbaseTemplateTransaction_AddsToBlockTemplate() { this.ExecuteWithConsensusOptions(new PowConsensusOptions(), () => { var chain = GenerateChainWithHeight(5, this.network, this.key); this.dateTimeProvider.Setup(d => d.GetAdjustedTimeAsUnixTimestamp()) .Returns(new DateTime(2017, 1, 7, 0, 0, 1, DateTimeKind.Utc).ToUnixTimestamp()); var powBlockAssembler = new PowTestBlockAssembler(this.consensusLoop.Object, this.dateTimeProvider.Object, this.LoggerFactory.Object, this.txMempool.Object, new MempoolSchedulerLock(), this.network); var result = powBlockAssembler.CreateCoinBase(chain.Tip, this.key.ScriptPubKey); Assert.NotEmpty(result.Block.Transactions); Assert.Equal(-1, result.TxSigOpsCost[0]); Assert.Equal(new Money(-1), result.VTxFees[0]); var resultingTransaction = result.Block.Transactions[0]; Assert.Equal((uint)new DateTime(2017, 1, 7, 0, 0, 1, DateTimeKind.Utc).ToUnixTimestamp(), resultingTransaction.Time); Assert.True(resultingTransaction.IsCoinBase); Assert.False(resultingTransaction.IsCoinStake); Assert.Equal(Money.Zero, resultingTransaction.TotalOut); Assert.NotEmpty(resultingTransaction.Inputs); Assert.Equal(TxIn.CreateCoinbase(6).ScriptSig, resultingTransaction.Inputs[0].ScriptSig); Assert.NotEmpty(resultingTransaction.Outputs); Assert.Equal(this.key.ScriptPubKey, resultingTransaction.Outputs[0].ScriptPubKey); Assert.Equal(Money.Zero, resultingTransaction.Outputs[0].Value); }); }