Documentation ¶
Index ¶
- Variables
- func NewMetaForkDetector(rounder consensus.Rounder, blackListHandler process.TimeCacher, ...) (*metaForkDetector, error)
- func NewShardForkDetector(rounder consensus.Rounder, blackListHandler process.TimeCacher, ...) (*shardForkDetector, error)
- type ArgBaseBootstrapper
- type ArgMetaBootstrapper
- type ArgShardBootstrapper
- type ErrSignedBlock
- type HdrInfo
- type MetaBootstrap
- func (boot MetaBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
- func (boot MetaBootstrap) Close() error
- func (boot MetaBootstrap) GetNodeState() core.NodeState
- func (boot MetaBootstrap) IsInterfaceNil() bool
- func (boot MetaBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
- func (boot *MetaBootstrap) StartSyncingBlocks()
- func (boot *MetaBootstrap) SyncBlock() error
- type ShardBootstrap
- func (boot ShardBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
- func (boot ShardBootstrap) Close() error
- func (boot ShardBootstrap) GetNodeState() core.NodeState
- func (boot ShardBootstrap) IsInterfaceNil() bool
- func (boot ShardBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
- func (boot *ShardBootstrap) StartSyncingBlocks()
- func (boot *ShardBootstrap) SyncBlock() error
- type TestMetaBootstrap
- func (boot TestMetaBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
- func (boot TestMetaBootstrap) Close() error
- func (boot TestMetaBootstrap) GetNodeState() core.NodeState
- func (boot TestMetaBootstrap) IsInterfaceNil() bool
- func (tmb *TestMetaBootstrap) RollBack(revertUsingForkNonce bool) error
- func (tmb *TestMetaBootstrap) SetProbableHighestNonce(nonce uint64)
- func (boot TestMetaBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
- type TestShardBootstrap
- func (boot TestShardBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
- func (boot TestShardBootstrap) Close() error
- func (boot TestShardBootstrap) GetNodeState() core.NodeState
- func (boot TestShardBootstrap) IsInterfaceNil() bool
- func (tsb *TestShardBootstrap) RollBack(revertUsingForkNonce bool) error
- func (tsb *TestShardBootstrap) SetProbableHighestNonce(nonce uint64)
- func (boot TestShardBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
Constants ¶
This section is empty.
Variables ¶
var ErrCorruptBootstrapFromStorageDb = errors.New("corrupt bootstrap storage database")
ErrCorruptBootstrapFromStorageDb signals that the bootstrap database is corrupt
var ErrGenesisTimeMissmatch = errors.New("genesis time missmatch")
ErrGenesisTimeMissmatch signals that a received header has a genesis time missmatch
var ErrHigherNonceInBlock = errors.New("higher nonce in block")
ErrHigherNonceInBlock signals that the nonce in block is higher than what could exist in the current round
var ErrHigherRoundInBlock = errors.New("higher round in block")
ErrHigherRoundInBlock signals that the round index in block is higher than the current round of chronology
var ErrLowerNonceInBlock = errors.New("lower nonce in block")
ErrLowerNonceInBlock signals that the nonce in block is lower than the last check point nonce
var ErrLowerRoundInBlock = errors.New("lower round in block")
ErrLowerRoundInBlock signals that the round index in block is lower than the checkpoint round
var ErrNilHash = errors.New("nil hash")
ErrNilHash signals that a nil hash has been provided
var ErrNilHeader = errors.New("nil header")
ErrNilHeader signals that a nil header has been provided
var ErrRollBackBehindFinalHeader = errors.New("roll back behind final header is not permitted")
ErrRollBackBehindFinalHeader signals that a roll back behind final header has been attempted
var ErrRollBackBehindForkNonce = errors.New("roll back behind fork nonce is not permitted")
ErrRollBackBehindForkNonce signals that a roll back behind fork nonce is not permitted
Functions ¶
func NewMetaForkDetector ¶
func NewMetaForkDetector( rounder consensus.Rounder, blackListHandler process.TimeCacher, blockTracker process.BlockTracker, genesisTime int64, ) (*metaForkDetector, error)
NewMetaForkDetector method creates a new metaForkDetector object
func NewShardForkDetector ¶
func NewShardForkDetector( rounder consensus.Rounder, blackListHandler process.TimeCacher, blockTracker process.BlockTracker, genesisTime int64, ) (*shardForkDetector, error)
NewShardForkDetector method creates a new shardForkDetector object
Types ¶
type ArgBaseBootstrapper ¶
type ArgBaseBootstrapper struct { PoolsHolder dataRetriever.PoolsHolder Store dataRetriever.StorageService ChainHandler data.ChainHandler Rounder consensus.Rounder BlockProcessor process.BlockProcessor WaitTime time.Duration Hasher hashing.Hasher Marshalizer marshal.Marshalizer ForkDetector process.ForkDetector RequestHandler process.RequestHandler ShardCoordinator sharding.Coordinator Accounts state.AccountsAdapter BlackListHandler process.TimeCacher NetworkWatcher process.NetworkConnectionWatcher BootStorer process.BootStorer StorageBootstrapper process.BootstrapperFromStorage EpochHandler dataRetriever.EpochHandler MiniblocksProvider process.MiniBlockProvider Uint64Converter typeConverters.Uint64ByteSliceConverter }
ArgBaseBootstrapper holds all dependencies required by the bootstrap data factory in order to create new instances
type ArgMetaBootstrapper ¶
type ArgMetaBootstrapper struct { ArgBaseBootstrapper EpochBootstrapper process.EpochBootstrapper }
ArgMetaBootstrapper holds all dependencies required by the bootstrap data factory in order to create new instances of meta bootstrapper
type ArgShardBootstrapper ¶
type ArgShardBootstrapper struct {
ArgBaseBootstrapper
}
ArgShardBootstrapper holds all dependencies required by the bootstrap data factory in order to create new instances of shard bootstrapper
type ErrSignedBlock ¶
type ErrSignedBlock struct {
CurrentNonce uint64
}
ErrSignedBlock signals that a block is signed
func (ErrSignedBlock) Error ¶
func (err ErrSignedBlock) Error() string
type MetaBootstrap ¶
type MetaBootstrap struct {
// contains filtered or unexported fields
}
MetaBootstrap implements the bootstrap mechanism
func NewMetaBootstrap ¶
func NewMetaBootstrap(arguments ArgMetaBootstrapper) (*MetaBootstrap, error)
NewMetaBootstrap creates a new Bootstrap object
func (MetaBootstrap) AddSyncStateListener ¶
func (boot MetaBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
AddSyncStateListener adds a syncStateListener that get notified each time the sync status of the node changes
func (MetaBootstrap) Close ¶ added in v1.0.116
func (boot MetaBootstrap) Close() error
Close will close the endless running go routine
func (MetaBootstrap) GetNodeState ¶
GetNodeState method returns the sync state of the node. If it returns 'NsNotSynchronized', this means that the node is not synchronized yet and it has to continue the bootstrapping mechanism. If it returns 'NsSynchronized', this means that the node is already synced and it can participate to the consensus. This method could also returns 'NsNotCalculated' which means that the state of the node in the current round is not calculated yet. Note that when the node is not connected to the network, GetNodeState could return 'NsNotSynchronized' but the SyncBlock is not automatically called.
func (MetaBootstrap) IsInterfaceNil ¶
func (boot MetaBootstrap) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (MetaBootstrap) SetStatusHandler ¶
func (boot MetaBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
SetStatusHandler will set the instance of the AppStatusHandler
func (*MetaBootstrap) StartSyncingBlocks ¶ added in v1.0.116
func (boot *MetaBootstrap) StartSyncingBlocks()
StartSyncingBlocks method will start syncing blocks as a go routine
func (*MetaBootstrap) SyncBlock ¶
func (boot *MetaBootstrap) SyncBlock() error
SyncBlock method actually does the synchronization. It requests the next block header from the pool and if it is not found there it will be requested from the network. After the header is received, it requests the block body in the same way(pool and than, if it is not found in the pool, from network). If either header and body are received the ProcessBlock and CommitBlock method will be called successively. These methods will execute the block and its transactions. Finally if everything works, the block will be committed in the blockchain, and all this mechanism will be reiterated for the next block.
type ShardBootstrap ¶
type ShardBootstrap struct {
// contains filtered or unexported fields
}
ShardBootstrap implements the bootstrap mechanism
func NewShardBootstrap ¶
func NewShardBootstrap(arguments ArgShardBootstrapper) (*ShardBootstrap, error)
NewShardBootstrap creates a new Bootstrap object
func (ShardBootstrap) AddSyncStateListener ¶
func (boot ShardBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
AddSyncStateListener adds a syncStateListener that get notified each time the sync status of the node changes
func (ShardBootstrap) Close ¶ added in v1.0.116
func (boot ShardBootstrap) Close() error
Close will close the endless running go routine
func (ShardBootstrap) GetNodeState ¶
GetNodeState method returns the sync state of the node. If it returns 'NsNotSynchronized', this means that the node is not synchronized yet and it has to continue the bootstrapping mechanism. If it returns 'NsSynchronized', this means that the node is already synced and it can participate to the consensus. This method could also returns 'NsNotCalculated' which means that the state of the node in the current round is not calculated yet. Note that when the node is not connected to the network, GetNodeState could return 'NsNotSynchronized' but the SyncBlock is not automatically called.
func (ShardBootstrap) IsInterfaceNil ¶
func (boot ShardBootstrap) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (ShardBootstrap) SetStatusHandler ¶
func (boot ShardBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
SetStatusHandler will set the instance of the AppStatusHandler
func (*ShardBootstrap) StartSyncingBlocks ¶ added in v1.0.116
func (boot *ShardBootstrap) StartSyncingBlocks()
StartSyncingBlocks method will start syncing blocks as a go routine
func (*ShardBootstrap) SyncBlock ¶
func (boot *ShardBootstrap) SyncBlock() error
SyncBlock method actually does the synchronization. It requests the next block header from the pool and if it is not found there it will be requested from the network. After the header is received, it requests the block body in the same way(pool and than, if it is not found in the pool, from network). If either header and body are received the ProcessBlock and CommitBlock method will be called successively. These methods will execute the block and its transactions. Finally if everything works, the block will be committed in the blockchain, and all this mechanism will be reiterated for the next block.
type TestMetaBootstrap ¶
type TestMetaBootstrap struct {
*MetaBootstrap
}
TestMetaBootstrap extends MetaBootstrap and is used in integration tests as it exposes some funcs that are not supposed to be used in production code Exported funcs simplify the reproduction of edge cases
func (TestMetaBootstrap) AddSyncStateListener ¶
func (boot TestMetaBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
AddSyncStateListener adds a syncStateListener that get notified each time the sync status of the node changes
func (TestMetaBootstrap) Close ¶ added in v1.0.116
func (boot TestMetaBootstrap) Close() error
Close will close the endless running go routine
func (TestMetaBootstrap) GetNodeState ¶
GetNodeState method returns the sync state of the node. If it returns 'NsNotSynchronized', this means that the node is not synchronized yet and it has to continue the bootstrapping mechanism. If it returns 'NsSynchronized', this means that the node is already synced and it can participate to the consensus. This method could also returns 'NsNotCalculated' which means that the state of the node in the current round is not calculated yet. Note that when the node is not connected to the network, GetNodeState could return 'NsNotSynchronized' but the SyncBlock is not automatically called.
func (TestMetaBootstrap) IsInterfaceNil ¶ added in v1.0.116
func (boot TestMetaBootstrap) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*TestMetaBootstrap) RollBack ¶
func (tmb *TestMetaBootstrap) RollBack(revertUsingForkNonce bool) error
RollBack decides to call (or not) the rollBackOneBlock on the current block from the blockchain structure
func (*TestMetaBootstrap) SetProbableHighestNonce ¶
func (tmb *TestMetaBootstrap) SetProbableHighestNonce(nonce uint64)
SetProbableHighestNonce sets the probable highest nonce in the contained fork detector
func (TestMetaBootstrap) SetStatusHandler ¶
func (boot TestMetaBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
SetStatusHandler will set the instance of the AppStatusHandler
type TestShardBootstrap ¶
type TestShardBootstrap struct {
*ShardBootstrap
}
TestShardBootstrap extends ShardBootstrap and is used in integration tests as it exposes some funcs that are not supposed to be used in production code Exported funcs simplify the reproduction of edge cases
func (TestShardBootstrap) AddSyncStateListener ¶
func (boot TestShardBootstrap) AddSyncStateListener(syncStateListener func(isSyncing bool))
AddSyncStateListener adds a syncStateListener that get notified each time the sync status of the node changes
func (TestShardBootstrap) Close ¶ added in v1.0.116
func (boot TestShardBootstrap) Close() error
Close will close the endless running go routine
func (TestShardBootstrap) GetNodeState ¶
GetNodeState method returns the sync state of the node. If it returns 'NsNotSynchronized', this means that the node is not synchronized yet and it has to continue the bootstrapping mechanism. If it returns 'NsSynchronized', this means that the node is already synced and it can participate to the consensus. This method could also returns 'NsNotCalculated' which means that the state of the node in the current round is not calculated yet. Note that when the node is not connected to the network, GetNodeState could return 'NsNotSynchronized' but the SyncBlock is not automatically called.
func (TestShardBootstrap) IsInterfaceNil ¶ added in v1.0.116
func (boot TestShardBootstrap) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*TestShardBootstrap) RollBack ¶
func (tsb *TestShardBootstrap) RollBack(revertUsingForkNonce bool) error
RollBack decides to call (or not) the rollBackOneBlock on the current block from the blockchain structure
func (*TestShardBootstrap) SetProbableHighestNonce ¶
func (tsb *TestShardBootstrap) SetProbableHighestNonce(nonce uint64)
SetProbableHighestNonce sets the probable highest nonce in the contained fork detector
func (TestShardBootstrap) SetStatusHandler ¶
func (boot TestShardBootstrap) SetStatusHandler(handler core.AppStatusHandler) error
SetStatusHandler will set the instance of the AppStatusHandler