7 "github.com/vapor/protocol/bc"
10 func TestCreateCoinbaseTx(t *testing.T) {
18 desc: "the coinbase block height is reductionInterval",
20 wantArbitrary: []byte{0x00, 0x31},
24 desc: "the coinbase block height is reductionInterval",
26 wantArbitrary: []byte{0x00, 0x31, 0x30, 0x30},
31 for i, c := range cases {
32 coinbaseTx, err := createCoinbaseTx(nil, c.blockHeight)
37 input, _ := coinbaseTx.Entries[coinbaseTx.Tx.InputIDs[0]].(*bc.Coinbase)
38 gotArbitrary := input.Arbitrary
39 if res := bytes.Compare(gotArbitrary, c.wantArbitrary); res != 0 {
40 t.Fatalf("coinbase tx arbitrary dismatch, case: %d, got: %d, want: %d", i, gotArbitrary, c.wantArbitrary)
43 gotAmount := coinbaseTx.Outputs[0].AssetAmount().Amount
44 if gotAmount != c.wantAmount {
45 t.Fatalf("coinbase tx output amount dismatch, case: %d, got: %d, want: %d", i, gotAmount, c.wantAmount)