(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestBadMaxNonceWindow(t *testing.T) { |
| 12 | ctx := context.Background() |
| 13 | c, b1 := newTestChain(t, time.Now()) |
| 14 | c.bb.MaxNonceWindow = time.Second |
| 15 | |
| 16 | tx := &bc.Tx{ |
| 17 | Nonces: []bc.Nonce{{ExpMS: bc.Millis(time.Now().Add(5 * time.Second))}}, |
| 18 | Finalized: true, |
| 19 | } |
| 20 | |
| 21 | got, _, err := c.GenerateBlock(ctx, b1.TimestampMs+1, []*bc.CommitmentsTx{bc.NewCommitmentsTx(tx)}) |
| 22 | if err != nil { |
| 23 | t.Fatal(err) |
| 24 | } |
| 25 | if len(got.Transactions) != 0 { |
| 26 | t.Error("expected issuance past max issuance window to be rejected") |
| 27 | } |
| 28 | |
| 29 | c.bb.MaxNonceWindow = 0 |
| 30 | got, _, err = c.GenerateBlock(ctx, b1.TimestampMs+1, []*bc.CommitmentsTx{bc.NewCommitmentsTx(tx)}) |
| 31 | if err != nil { |
| 32 | t.Fatal(err) |
| 33 | } |
| 34 | if len(got.Transactions) != 1 { |
| 35 | t.Error("expected 0 max issuance to be ignored") |
| 36 | } |
| 37 | } |
nothing calls this directly
no test coverage detected