Documentation
¶
Index ¶
- func GenesisBlock(signatories id.Signatories) block.Block
- func GetStateFromProcess(p *process.Process, f int) process.State
- func NewMockBroadcaster(broadcastMessages, castMessages chan<- process.Message) process.Broadcaster
- func NewMockProposer(key *ecdsa.PrivateKey) process.Proposer
- func NewMockSaveRestorer() process.SaveRestorer
- func NewMockScheduler(sig id.Signatory) process.Scheduler
- func NewMockTimer(timeout time.Duration) process.Timer
- func NewMockValidator(valid error) process.Validator
- func RandomBlock(kind block.Kind) block.Block
- func RandomBlockHeader(kind block.Kind) block.Header
- func RandomBlockKind() block.Kind
- func RandomBytesSlice() []byte
- func RandomHash() id.Hash
- func RandomHashes() id.Hashes
- func RandomHeight() block.Height
- func RandomInbox(f int, t process.MessageType) *process.Inbox
- func RandomMessage(t process.MessageType) process.Message
- func RandomMessageType(includeResync bool) process.MessageType
- func RandomMessageWithHeightAndRound(height block.Height, round block.Round, t process.MessageType) process.Message
- func RandomPrecommit() *process.Precommit
- func RandomPrevote() *process.Prevote
- func RandomPropose() *process.Propose
- func RandomResync() *process.Resync
- func RandomRound() block.Round
- func RandomSignatories() id.Signatories
- func RandomSignatory() id.Signatory
- func RandomSignature() id.Signature
- func RandomSignatures() id.Signatures
- func RandomSignedMessage(t process.MessageType) process.Message
- func RandomSingedMessageWithHeightAndRound(height block.Height, round block.Round, t process.MessageType) process.Message
- func RandomState() process.State
- func RandomStep() process.Step
- type BlockHeaderJSON
- type BlockJSON
- type MockBlockchain
- func (bc *MockBlockchain) BlockAtHeight(height block.Height) (block.Block, bool)
- func (bc *MockBlockchain) BlockExistsAtHeight(height block.Height) bool
- func (bc *MockBlockchain) InsertBlockAtHeight(height block.Height, block block.Block)
- func (bc *MockBlockchain) InsertBlockStateAtHeight(height block.Height, state block.State)
- func (bc *MockBlockchain) LatestBlock(kind block.Kind) block.Block
- func (bc *MockBlockchain) StateAtHeight(height block.Height) (block.State, bool)
- type MockBroadcaster
- type MockObserver
- type MockProposer
- type MockSaveRestorer
- type MockScheduler
- type MockTimer
- type MockValidator
- type ProcessOrigin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenesisBlock ¶
func GenesisBlock(signatories id.Signatories) block.Block
func NewMockBroadcaster ¶
func NewMockBroadcaster(broadcastMessages, castMessages chan<- process.Message) process.Broadcaster
func NewMockProposer ¶
func NewMockProposer(key *ecdsa.PrivateKey) process.Proposer
func NewMockSaveRestorer ¶ added in v0.4.2
func NewMockSaveRestorer() process.SaveRestorer
func NewMockValidator ¶
func RandomBlockHeader ¶
RandomBlockHeader generates a random block.Header of the given kind which guarantee to be valid.
func RandomBlockKind ¶
RandomBlockKind returns a random valid block kind.
func RandomBytesSlice ¶
func RandomBytesSlice() []byte
RandomBytesSlice returns a random bytes slice.
func RandomHash ¶
func RandomHashes ¶
func RandomHeight ¶
func RandomInbox ¶
func RandomInbox(f int, t process.MessageType) *process.Inbox
func RandomMessage ¶
func RandomMessage(t process.MessageType) process.Message
func RandomMessageType ¶
func RandomMessageType(includeResync bool) process.MessageType
func RandomPrecommit ¶
func RandomPrevote ¶
func RandomPropose ¶
func RandomResync ¶ added in v0.4.2
func RandomRound ¶
func RandomSignatories ¶
func RandomSignatories() id.Signatories
func RandomSignatory ¶
func RandomSignature ¶
func RandomSignatures ¶
func RandomSignatures() id.Signatures
func RandomSignedMessage ¶
func RandomSignedMessage(t process.MessageType) process.Message
func RandomStep ¶
Types ¶
type BlockHeaderJSON ¶
type BlockHeaderJSON struct {
Kind block.Kind `json:"kind"`
ParentHash id.Hash `json:"parentHash"`
BaseHash id.Hash `json:"baseHash"`
TxsRef id.Hash `json:"txsRef"`
PlanRef id.Hash `json:"planRef"`
PrevStateRef id.Hash `json:"prevStateRef"`
Height block.Height `json:"height"`
Round block.Round `json:"round"`
Timestamp block.Timestamp `json:"timestamp"`
Signatories id.Signatories `json:"signatories"`
}
BlockHeaderJSON is almost a copy of the block.Header struct except all fields are exposed. This is for the convenience of initializing and marshaling.
func RandomBlockHeaderJSON ¶
func RandomBlockHeaderJSON(kind block.Kind) BlockHeaderJSON
RandomBlockHeaderJSON returns a valid BlockHeaderJSON of the given kind block.
func (BlockHeaderJSON) ToBlockHeader ¶
func (header BlockHeaderJSON) ToBlockHeader() block.Header
ToBlockHeader converts the BlockHeaderJSON object to a block.Header.
type BlockJSON ¶
type BlockJSON struct {
Hash id.Hash `json:"hash"`
Header block.Header `json:"header"`
Txs block.Txs `json:"txs"`
Plan block.Plan `json:"plan"`
PrevState block.State `json:"prevState"`
}
BlockHeaderJSON is almost a copy of the block.Header struct except all fields are exposed. This is for the convenience of initializing and marshaling.
type MockBlockchain ¶
type MockBlockchain struct {
// contains filtered or unexported fields
}
func NewMockBlockchain ¶
func NewMockBlockchain(signatories id.Signatories) *MockBlockchain
func (*MockBlockchain) BlockAtHeight ¶
func (*MockBlockchain) BlockExistsAtHeight ¶
func (bc *MockBlockchain) BlockExistsAtHeight(height block.Height) bool
func (*MockBlockchain) InsertBlockAtHeight ¶
func (bc *MockBlockchain) InsertBlockAtHeight(height block.Height, block block.Block)
func (*MockBlockchain) InsertBlockStateAtHeight ¶ added in v0.4.2
func (bc *MockBlockchain) InsertBlockStateAtHeight(height block.Height, state block.State)
func (*MockBlockchain) LatestBlock ¶
func (bc *MockBlockchain) LatestBlock(kind block.Kind) block.Block
func (*MockBlockchain) StateAtHeight ¶
type MockBroadcaster ¶
type MockBroadcaster struct {
// contains filtered or unexported fields
}
func (*MockBroadcaster) Broadcast ¶
func (m *MockBroadcaster) Broadcast(message process.Message)
type MockObserver ¶
type MockObserver struct {
}
func (MockObserver) DidCommitBlock ¶
func (m MockObserver) DidCommitBlock(block.Height)
func (MockObserver) DidReceiveSufficientNilPrevotes ¶ added in v0.3.2
func (m MockObserver) DidReceiveSufficientNilPrevotes(process.Messages, int)
type MockProposer ¶
type MockProposer struct {
Key *ecdsa.PrivateKey
}
func (*MockProposer) BlockProposal ¶
type MockSaveRestorer ¶ added in v0.4.2
type MockSaveRestorer struct {
}
func (*MockSaveRestorer) Restore ¶ added in v0.4.2
func (m *MockSaveRestorer) Restore(state *process.State)
func (*MockSaveRestorer) Save ¶ added in v0.4.2
func (m *MockSaveRestorer) Save(state *process.State)
type MockScheduler ¶
type MockScheduler struct {
// contains filtered or unexported fields
}
type MockValidator ¶
type MockValidator struct {
// contains filtered or unexported fields
}
func (MockValidator) IsBlockValid ¶
func (m MockValidator) IsBlockValid(block.Block, bool) (process.NilReasons, error)
type ProcessOrigin ¶
type ProcessOrigin struct {
PrivateKey *ecdsa.PrivateKey
Signatory id.Signatory
Blockchain process.Blockchain
State process.State
BroadcastMessages chan process.Message
CastMessages chan process.Message
SaveRestorer process.SaveRestorer
Proposer process.Proposer
Validator process.Validator
Scheduler process.Scheduler
Broadcaster process.Broadcaster
Timer process.Timer
Observer process.Observer
}
func NewProcessOrigin ¶
func NewProcessOrigin(f int) ProcessOrigin
func (ProcessOrigin) ToProcess ¶
func (p ProcessOrigin) ToProcess() *process.Process
func (*ProcessOrigin) UpdateState ¶ added in v0.4.2
func (p *ProcessOrigin) UpdateState(state process.State)
Click to show internal directories.
Click to hide internal directories.