Documentation
¶
Index ¶
- Constants
- Variables
- func NewFSM(services services.Services, microblockInterval, obsolescence time.Duration, ...) (*FSM, Async, error)
- type Actions
- type ActionsImpl
- type Async
- type BaseInfo
- type BlocksApplier
- type FSM
- func (f *FSM) Block(p peer.Peer, block *proto.Block) (Async, error)
- func (f *FSM) BlockEndorsement(endorseBlock *proto.EndorseBlock) (Async, error)
- func (f *FSM) BlockIDs(peer peer.Peer, signatures []proto.BlockID) (Async, error)
- func (f *FSM) BlockSnapshot(p peer.Peer, blockID proto.BlockID, snapshots proto.BlockSnapshot) (Async, error)
- func (f *FSM) ChangeSyncPeer(p peer.Peer) (Async, error)
- func (f *FSM) Halt() (Async, error)
- func (f *FSM) MicroBlock(p peer.Peer, micro *proto.MicroBlock) (Async, error)
- func (f *FSM) MicroBlockInv(p peer.Peer, inv *proto.MicroBlockInv) (Async, error)
- func (f *FSM) MicroBlockSnapshot(p peer.Peer, blockID proto.BlockID, snapshots proto.BlockSnapshot) (Async, error)
- func (f *FSM) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, ...) (Async, error)
- func (f *FSM) NewPeer(p peer.Peer) (Async, error)
- func (f *FSM) PeerError(p peer.Peer, e error) (Async, error)
- func (f *FSM) Score(p peer.Peer, score *proto.Score) (Async, error)
- func (f *FSM) StartMining() (Async, error)
- func (f *FSM) StopMining() (Async, error)
- func (f *FSM) StopSync() (Async, error)
- func (f *FSM) Task(task tasks.AsyncTask) (Async, error)
- func (f *FSM) Transaction(p peer.Peer, t proto.Transaction) (Async, error)
- type HaltState
- type IdleState
- func (a *IdleState) Errorf(err error) error
- func (a *IdleState) Halt() (State, Async, error)
- func (a *IdleState) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, ...) (State, Async, error)
- func (a *IdleState) Score(p peer.Peer, score *proto.Score) (State, Async, error)
- func (a *IdleState) StartMining() (State, Async, error)
- func (a *IdleState) String() string
- func (a *IdleState) Task(task tasks.AsyncTask) (State, Async, error)
- func (a *IdleState) Transaction(p peer.Peer, t proto.Transaction) (State, Async, error)
- type InvRequester
- type NGState
- func (a *NGState) Block(peer peer.Peer, block *proto.Block) (State, Async, error)
- func (a *NGState) BlockEndorsement(blockEndorsement *proto.EndorseBlock) (State, Async, error)
- func (a *NGState) Endorse(parentBlockID proto.BlockID, height proto.Height, endorserPK bls.PublicKey, ...) error
- func (a *NGState) EndorseParentWithEachKey(pks []bls.PublicKey, sks []bls.SecretKey, block *proto.Block, ...) error
- func (a *NGState) Errorf(err error) error
- func (a *NGState) Halt() (State, Async, error)
- func (a *NGState) MicroBlock(p peer.Peer, micro *proto.MicroBlock) (State, Async, error)
- func (a *NGState) MicroBlockInv(p peer.Peer, inv *proto.MicroBlockInv) (State, Async, error)
- func (a *NGState) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, ...) (State, Async, error)
- func (a *NGState) Score(p peer.Peer, score *proto.Score) (State, Async, error)
- func (a *NGState) StopMining() (State, Async, error)
- func (a *NGState) String() string
- func (a *NGState) Task(task tasks.AsyncTask) (State, Async, error)
- func (a *NGState) Transaction(p peer.Peer, t proto.Transaction) (State, Async, error)
- type PersistState
- func (a *PersistState) Errorf(err error) error
- func (a *PersistState) Halt() (State, Async, error)
- func (a *PersistState) Score(p peer.Peer, score *proto.Score) (State, Async, error)
- func (a *PersistState) StopMining() (State, Async, error)
- func (a *PersistState) String() string
- func (a *PersistState) Task(t tasks.AsyncTask) (State, Async, error)
- type ReceivedScore
- type State
- type StateData
- type SyncState
- func (a *SyncState) Block(p peer.Peer, block *proto.Block) (State, Async, error)
- func (a *SyncState) BlockIDs(peer peer.Peer, signatures []proto.BlockID) (State, Async, error)
- func (a *SyncState) BlockSnapshot(p peer.Peer, blockID proto.BlockID, snapshot proto.BlockSnapshot) (State, Async, error)
- func (a *SyncState) ChangeSyncPeer(p peer.Peer) (State, Async, error)
- func (a *SyncState) Errorf(err error) error
- func (a *SyncState) Halt() (State, Async, error)
- func (a *SyncState) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, ...) (State, Async, error)
- func (a *SyncState) Score(p peer.Peer, score *proto.Score) (State, Async, error)
- func (a *SyncState) StopSync() (State, Async, error)
- func (a *SyncState) String() string
- func (a *SyncState) Task(task tasks.AsyncTask) (State, Async, error)
- func (a *SyncState) Transaction(p peer.Peer, t proto.Transaction) (State, Async, error)
- type WaitMicroSnapshotState
- func (a *WaitMicroSnapshotState) Errorf(err error) error
- func (a *WaitMicroSnapshotState) MicroBlockSnapshot(_ peer.Peer, blockID proto.BlockID, snapshot proto.BlockSnapshot) (State, Async, error)
- func (a *WaitMicroSnapshotState) Score(p peer.Peer, score *proto.Score) (State, Async, error)
- func (a *WaitMicroSnapshotState) String() string
- func (a *WaitMicroSnapshotState) Task(task tasks.AsyncTask) (State, Async, error)
- type WaitSnapshotState
- func (a *WaitSnapshotState) BlockSnapshot(_ peer.Peer, blockID proto.BlockID, snapshot proto.BlockSnapshot) (State, Async, error)
- func (a *WaitSnapshotState) Errorf(err error) error
- func (a *WaitSnapshotState) Score(p peer.Peer, score *proto.Score) (State, Async, error)
- func (a *WaitSnapshotState) String() string
- func (a *WaitSnapshotState) Task(task tasks.AsyncTask) (State, Async, error)
Constants ¶
View Source
const ( IdleStateName = "Idle" NGStateName = "NG" WaitSnapshotStateName = "WaitSnapshot" WaitMicroSnapshotStateName = "WaitMicroSnapshot" PersistStateName = "Persist" SyncStateName = "Sync" HaltStateName = "Halt" )
States.
View Source
const ( NewPeerEvent = "NewPeer" PeerErrorEvent = "PeerError" ScoreEvent = "Score" BlockEvent = "Block" MinedBlockEvent = "MinedBlock" BlockIDsEvent = "BlockIDs" TaskEvent = "Task" MicroBlockEvent = "MicroBlock" MicroBlockInvEvent = "MicroBlockInv" TransactionEvent = "Transaction" HaltEvent = "Halt" StopSyncEvent = "StopSync" StopMiningEvent = "StopMining" StartMiningEvent = "StartMining" ChangeSyncPeerEvent = "ChangeSyncPeer" BlockSnapshotEvent = "BlockSnapshotEvent" BlockEndorsementEvent = "EndorseBlock" MicroBlockSnapshotEvent = "MicroBlockSnapshotEvent" )
Events. TODO: Consider replacing with empty structs with Stringer implemented.
Variables ¶
View Source
var TimeoutErr = proto.NewInfoMsg(errors.New("timeout"))
Functions ¶
Types ¶
type Actions ¶
type Actions interface {
SendScore(currentScorer)
SendBlock(block *proto.Block)
SendEndorseBlock(endorse *proto.EndorseBlock)
}
type ActionsImpl ¶
type ActionsImpl struct {
// contains filtered or unexported fields
}
func (*ActionsImpl) SendBlock ¶
func (a *ActionsImpl) SendBlock(block *proto.Block)
func (*ActionsImpl) SendEndorseBlock ¶
func (a *ActionsImpl) SendEndorseBlock(endorse *proto.EndorseBlock)
func (*ActionsImpl) SendScore ¶
func (a *ActionsImpl) SendScore(s currentScorer)
type BaseInfo ¶
type BaseInfo struct {
MicroBlockCache services.MicroBlockCache
MicroBlockInvCache services.MicroBlockInvCache
// contains filtered or unexported fields
}
func (*BaseInfo) BroadcastTransaction ¶
func (a *BaseInfo) BroadcastTransaction(t proto.Transaction, receivedFrom peer.Peer)
func (*BaseInfo) CancelCleanUTX ¶
func (a *BaseInfo) CancelCleanUTX()
CancelCleanUTX cancels the ongoing UTX cleaning process if it is running. It does nothing if no cleaning process is running. This method is not thread-safe and should be called from a single goroutine.
func (*BaseInfo) CleanUtx ¶
func (a *BaseInfo) CleanUtx()
CleanUtx starts a goroutine to clean the UTX pool. It uses an internal context to allow cancellation of the cleaning process. If a cleaning process is already running, it does nothing. Not thread-safe, should be called from a single goroutine.
type BlocksApplier ¶
type BlocksApplier interface {
BlockExists(state storage.State, block *proto.Block) (bool, error)
Apply(
state storage.State,
block []*proto.Block,
) (proto.Height, error)
ApplyMicro(
state storage.State,
block *proto.Block,
) (proto.Height, error)
ApplyWithSnapshots(
state storage.State,
block []*proto.Block,
snapshots []*proto.BlockSnapshot,
) (proto.Height, error)
ApplyMicroWithSnapshots(
state storage.State,
block *proto.Block,
snapshots *proto.BlockSnapshot,
) (proto.Height, error)
}
type FSM ¶
type FSM struct {
State *StateData
// contains filtered or unexported fields
}
func (*FSM) BlockEndorsement ¶
func (f *FSM) BlockEndorsement(endorseBlock *proto.EndorseBlock) (Async, error)
func (*FSM) BlockSnapshot ¶
func (*FSM) MicroBlock ¶
func (*FSM) MicroBlockInv ¶
func (*FSM) MicroBlockSnapshot ¶
func (*FSM) MinedBlock ¶
func (*FSM) StartMining ¶
func (*FSM) StopMining ¶
func (*FSM) Transaction ¶
type IdleState ¶
type IdleState struct {
// contains filtered or unexported fields
}
func (*IdleState) MinedBlock ¶
func (*IdleState) Transaction ¶
type InvRequester ¶
type NGState ¶
type NGState struct {
// contains filtered or unexported fields
}
func (*NGState) BlockEndorsement ¶
func (*NGState) EndorseParentWithEachKey ¶
func (*NGState) MicroBlock ¶
func (*NGState) MicroBlockInv ¶
func (*NGState) MinedBlock ¶
func (*NGState) Transaction ¶
type PersistState ¶
type PersistState struct {
// contains filtered or unexported fields
}
func (*PersistState) Errorf ¶
func (a *PersistState) Errorf(err error) error
func (*PersistState) StopMining ¶
func (a *PersistState) StopMining() (State, Async, error)
func (*PersistState) String ¶
func (a *PersistState) String() string
type SyncState ¶
type SyncState struct {
// contains filtered or unexported fields
}
func (*SyncState) BlockSnapshot ¶
func (*SyncState) ChangeSyncPeer ¶
func (*SyncState) MinedBlock ¶
func (*SyncState) Transaction ¶
type WaitMicroSnapshotState ¶
type WaitMicroSnapshotState struct {
// contains filtered or unexported fields
}
func (*WaitMicroSnapshotState) Errorf ¶
func (a *WaitMicroSnapshotState) Errorf(err error) error
func (*WaitMicroSnapshotState) MicroBlockSnapshot ¶
func (a *WaitMicroSnapshotState) MicroBlockSnapshot( _ peer.Peer, blockID proto.BlockID, snapshot proto.BlockSnapshot, ) (State, Async, error)
func (*WaitMicroSnapshotState) String ¶
func (a *WaitMicroSnapshotState) String() string
type WaitSnapshotState ¶
type WaitSnapshotState struct {
// contains filtered or unexported fields
}
func (*WaitSnapshotState) BlockSnapshot ¶
func (a *WaitSnapshotState) BlockSnapshot( _ peer.Peer, blockID proto.BlockID, snapshot proto.BlockSnapshot, ) (State, Async, error)
func (*WaitSnapshotState) Errorf ¶
func (a *WaitSnapshotState) Errorf(err error) error
func (*WaitSnapshotState) String ¶
func (a *WaitSnapshotState) String() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.