Documentation
¶
Index ¶
- func AssertBlockEqual(t *testing.T, expected, actual block.Block)
- type CantBuildBlock
- type CantGetBlock
- type CantLastAccepted
- type CantParseBlock
- type CantSetPreference
- type TestBlock
- type TestDecidable
- type TestVM
- func (vm *TestVM) BuildBlock(ctx context.Context) (block.Block, error)
- func (vm *TestVM) GetBlock(ctx context.Context, blkID ids.ID) (block.Block, error)
- func (vm *TestVM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *TestVM) ParseBlock(ctx context.Context, b []byte) (block.Block, error)
- func (vm *TestVM) SetPreference(ctx context.Context, blkID ids.ID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CantGetBlock ¶
type CantGetBlock struct{}
type TestBlock ¶
type TestBlock struct {
TestDecidable
HeightV uint64
TimeV uint64
VerifyV error
BytesV []byte
}
TestBlock is a test implementation of block.Block
func MakeBlock ¶
func MakeBlock( id ids.ID, parent ids.ID, height uint64, timestamp uint64, status choices.Status, ) *TestBlock
MakeBlock creates a new test block
type TestDecidable ¶
type TestDecidable struct {
IDV ids.ID
AcceptV error
RejectV error
StatusV choices.Status
ParentV ids.ID
}
TestDecidable is embedded in TestBlock to implement choices.Decidable.
func (*TestDecidable) Accept ¶
func (d *TestDecidable) Accept() error
func (*TestDecidable) ID ¶
func (d *TestDecidable) ID() ids.ID
func (*TestDecidable) Parent ¶
func (d *TestDecidable) Parent() ids.ID
func (*TestDecidable) Reject ¶
func (d *TestDecidable) Reject() error
func (*TestDecidable) Status ¶
func (d *TestDecidable) Status() choices.Status
type TestVM ¶
type TestVM struct {
CantBuildBlock
CantParseBlock
CantGetBlock
CantSetPreference
CantLastAccepted
BuildBlockF func(context.Context) (block.Block, error)
ParseBlockF func(context.Context, []byte) (block.Block, error)
GetBlockF func(context.Context, ids.ID) (block.Block, error)
SetPreferenceF func(context.Context, ids.ID) error
LastAcceptedF func(context.Context) (ids.ID, error)
}
TestVM is a test implementation of block.ChainVM
func (*TestVM) ParseBlock ¶
Click to show internal directories.
Click to hide internal directories.