forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_block.go
53 lines (41 loc) · 991 Bytes
/
test_block.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package snowman
import (
"context"
"time"
"github.com/MetalBlockchain/metalgo/ids"
"github.com/MetalBlockchain/metalgo/snow/choices"
"github.com/MetalBlockchain/metalgo/utils"
)
var (
_ Block = (*TestBlock)(nil)
_ utils.Sortable[*TestBlock] = (*TestBlock)(nil)
)
// TestBlock is a useful test block
type TestBlock struct {
choices.TestDecidable
ParentV ids.ID
HeightV uint64
TimestampV time.Time
VerifyV error
BytesV []byte
}
func (b *TestBlock) Parent() ids.ID {
return b.ParentV
}
func (b *TestBlock) Height() uint64 {
return b.HeightV
}
func (b *TestBlock) Timestamp() time.Time {
return b.TimestampV
}
func (b *TestBlock) Verify(context.Context) error {
return b.VerifyV
}
func (b *TestBlock) Bytes() []byte {
return b.BytesV
}
func (b *TestBlock) Less(other *TestBlock) bool {
return b.HeightV < other.HeightV
}