Documentation ¶
Overview ¶
Package blocks is a generated GoMock package.
Index ¶
- Variables
- func RegisterBlockTypes(targetCodec codec.Registry) error
- type AbortBlock
- type AtomicBlock
- type Block
- type CommitBlock
- type CommonBlock
- type MockBlock
- type MockBlockMockRecorder
- func (mr *MockBlockMockRecorder) Bytes() *gomock.Call
- func (mr *MockBlockMockRecorder) Height() *gomock.Call
- func (mr *MockBlockMockRecorder) ID() *gomock.Call
- func (mr *MockBlockMockRecorder) Parent() *gomock.Call
- func (mr *MockBlockMockRecorder) Txs() *gomock.Call
- func (mr *MockBlockMockRecorder) Visit(visitor interface{}) *gomock.Call
- type ProposalBlock
- type StandardBlock
- type Visitor
Constants ¶
This section is empty.
Variables ¶
var ( Codec codec.Manager GenesisCodec codec.Manager )
GenesisCode allows blocks of larger than usual size to be parsed. While this gives flexibility in accommodating large genesis blocks it must not be used to parse new, unverified blocks which instead must be processed by Codec
Functions ¶
func RegisterBlockTypes ¶
RegisterBlockTypes allows registering relevant type of blocks package in the right sequence. Following repackaging of platformvm package, a few subpackage-level codecs were introduced, each handling serialization of specific types.
Types ¶
type AbortBlock ¶
type AbortBlock struct {
CommonBlock `serialize:"true"`
}
func NewAbortBlock ¶
func NewAbortBlock( parentID ids.ID, height uint64, ) (*AbortBlock, error)
func (*AbortBlock) Txs ¶
func (ab *AbortBlock) Txs() []*txs.Tx
func (*AbortBlock) Visit ¶
func (ab *AbortBlock) Visit(v Visitor) error
type AtomicBlock ¶
type AtomicBlock struct { CommonBlock `serialize:"true"` Tx *txs.Tx `serialize:"true" json:"tx"` }
AtomicBlock being accepted results in the atomic transaction contained in the block to be accepted and committed to the chain.
func NewAtomicBlock ¶
func (*AtomicBlock) Txs ¶
func (ab *AtomicBlock) Txs() []*txs.Tx
func (*AtomicBlock) Visit ¶
func (ab *AtomicBlock) Visit(v Visitor) error
type Block ¶
type Block interface { ID() ids.ID Parent() ids.ID Bytes() []byte Height() uint64 // Txs returns list of transactions contained in the block Txs() []*txs.Tx Visit(visitor Visitor) error // contains filtered or unexported methods }
Block defines the common stateless interface for all blocks
type CommitBlock ¶
type CommitBlock struct {
CommonBlock `serialize:"true"`
}
func NewCommitBlock ¶
func NewCommitBlock( parentID ids.ID, height uint64, ) (*CommitBlock, error)
func (*CommitBlock) Txs ¶
func (cb *CommitBlock) Txs() []*txs.Tx
func (*CommitBlock) Visit ¶
func (cb *CommitBlock) Visit(v Visitor) error
type CommonBlock ¶
type CommonBlock struct { PrntID ids.ID `serialize:"true" json:"parentID"` // parent's ID Hght uint64 `serialize:"true" json:"height"` // This block's height. The genesis block is at height 0. // contains filtered or unexported fields }
CommonBlock contains fields and methods common to all blocks in this VM.
func (*CommonBlock) Bytes ¶
func (b *CommonBlock) Bytes() []byte
func (*CommonBlock) Height ¶
func (b *CommonBlock) Height() uint64
func (*CommonBlock) ID ¶
func (b *CommonBlock) ID() ids.ID
func (*CommonBlock) Parent ¶
func (b *CommonBlock) Parent() ids.ID
type MockBlock ¶
type MockBlock struct {
// contains filtered or unexported fields
}
MockBlock is a mock of Block interface.
func NewMockBlock ¶
func NewMockBlock(ctrl *gomock.Controller) *MockBlock
NewMockBlock creates a new mock instance.
func (*MockBlock) EXPECT ¶
func (m *MockBlock) EXPECT() *MockBlockMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockBlockMockRecorder ¶
type MockBlockMockRecorder struct {
// contains filtered or unexported fields
}
MockBlockMockRecorder is the mock recorder for MockBlock.
func (*MockBlockMockRecorder) Bytes ¶
func (mr *MockBlockMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes.
func (*MockBlockMockRecorder) Height ¶
func (mr *MockBlockMockRecorder) Height() *gomock.Call
Height indicates an expected call of Height.
func (*MockBlockMockRecorder) ID ¶
func (mr *MockBlockMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockBlockMockRecorder) Parent ¶
func (mr *MockBlockMockRecorder) Parent() *gomock.Call
Parent indicates an expected call of Parent.
func (*MockBlockMockRecorder) Txs ¶
func (mr *MockBlockMockRecorder) Txs() *gomock.Call
Txs indicates an expected call of Txs.
func (*MockBlockMockRecorder) Visit ¶
func (mr *MockBlockMockRecorder) Visit(visitor interface{}) *gomock.Call
Visit indicates an expected call of Visit.
type ProposalBlock ¶
type ProposalBlock struct { CommonBlock `serialize:"true"` Tx *txs.Tx `serialize:"true" json:"tx"` }
As is, this is duplication of atomic block. But let's tolerate some code duplication for now
func NewProposalBlock ¶
func (*ProposalBlock) Txs ¶
func (pb *ProposalBlock) Txs() []*txs.Tx
func (*ProposalBlock) Visit ¶
func (pb *ProposalBlock) Visit(v Visitor) error
type StandardBlock ¶
type StandardBlock struct { CommonBlock `serialize:"true"` Transactions []*txs.Tx `serialize:"true" json:"txs"` }
func NewStandardBlock ¶
func (*StandardBlock) Txs ¶
func (sb *StandardBlock) Txs() []*txs.Tx
func (*StandardBlock) Visit ¶
func (sb *StandardBlock) Visit(v Visitor) error
type Visitor ¶
type Visitor interface { AtomicBlock(*AtomicBlock) error ProposalBlock(*ProposalBlock) error StandardBlock(*StandardBlock) error AbortBlock(*AbortBlock) error CommitBlock(*CommitBlock) error }