forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_vertex.go
60 lines (47 loc) · 1.29 KB
/
test_vertex.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
54
55
56
57
58
59
60
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package avalanche
import (
"context"
"github.com/MetalBlockchain/metalgo/ids"
"github.com/MetalBlockchain/metalgo/snow/choices"
"github.com/MetalBlockchain/metalgo/snow/consensus/snowstorm"
"github.com/MetalBlockchain/metalgo/utils/set"
)
var _ Vertex = (*TestVertex)(nil)
// TestVertex is a useful test vertex
type TestVertex struct {
choices.TestDecidable
VerifyErrV error
ParentsV []Vertex
ParentsErrV error
HasWhitelistV bool
WhitelistV set.Set[ids.ID]
WhitelistErrV error
HeightV uint64
HeightErrV error
TxsV []snowstorm.Tx
TxsErrV error
BytesV []byte
}
func (v *TestVertex) Verify(context.Context) error {
return v.VerifyErrV
}
func (v *TestVertex) Parents() ([]Vertex, error) {
return v.ParentsV, v.ParentsErrV
}
func (v *TestVertex) HasWhitelist() bool {
return v.HasWhitelistV
}
func (v *TestVertex) Whitelist(context.Context) (set.Set[ids.ID], error) {
return v.WhitelistV, v.WhitelistErrV
}
func (v *TestVertex) Height() (uint64, error) {
return v.HeightV, v.HeightErrV
}
func (v *TestVertex) Txs(context.Context) ([]snowstorm.Tx, error) {
return v.TxsV, v.TxsErrV
}
func (v *TestVertex) Bytes() []byte {
return v.BytesV
}