6 "github.com/vapor/consensus"
9 func TestCreateCoinbaseTx(t *testing.T) {
10 consensus.ActiveNetParams = consensus.Params{
11 ProducerSubsidys: []consensus.ProducerSubsidy{
12 {BeginBlock: 0, EndBlock: 0, Subsidy: 24},
13 {BeginBlock: 1, EndBlock: 840000, Subsidy: 24},
14 {BeginBlock: 840001, EndBlock: 1680000, Subsidy: 12},
15 {BeginBlock: 1680001, EndBlock: 3360000, Subsidy: 6},
18 reductionInterval := uint64(840000)
25 height: reductionInterval - 1,
27 subsidy: 24 + 100000000,
30 height: reductionInterval,
32 subsidy: 24 + 2000000000,
35 height: reductionInterval + 1,
40 height: reductionInterval * 2,
42 subsidy: 12 + 100000000,
46 for index, c := range cases {
47 coinbaseTx, err := createCoinbaseTx(nil, c.txFee, c.height)
52 outputAmount := coinbaseTx.Outputs[0].OutputCommitment().Amount
53 if outputAmount != c.subsidy {
54 t.Fatalf("index:%d,coinbase tx reward dismatch, expected: %d, have: %d", index, c.subsidy, outputAmount)