Documentation ¶
Index ¶
- Variables
- type BlockChain
- func (bc *BlockChain) GetCurrentBlockBody() data.BodyHandler
- func (bc *BlockChain) GetCurrentBlockHeader() data.HeaderHandler
- func (bc *BlockChain) GetCurrentBlockHeaderHash() []byte
- func (bc *BlockChain) GetGenesisHeader() data.HeaderHandler
- func (bc *BlockChain) GetGenesisHeaderHash() []byte
- func (bc *BlockChain) GetLocalHeight() int64
- func (bc *BlockChain) GetNetworkHeight() int64
- func (bc *BlockChain) HasBadBlock(blockHash []byte) bool
- func (bc *BlockChain) IsInterfaceNil() bool
- func (bc *BlockChain) PutBadBlock(blockHash []byte)
- func (bc *BlockChain) SetAppStatusHandler(ash core.AppStatusHandler) error
- func (bc *BlockChain) SetCurrentBlockBody(body data.BodyHandler) error
- func (bc *BlockChain) SetCurrentBlockHeader(header data.HeaderHandler) error
- func (bc *BlockChain) SetCurrentBlockHeaderHash(hash []byte)
- func (bc *BlockChain) SetGenesisHeader(genesisBlock data.HeaderHandler) error
- func (bc *BlockChain) SetGenesisHeaderHash(hash []byte)
- func (bc *BlockChain) SetLocalHeight(height int64)
- func (bc *BlockChain) SetNetworkHeight(height int64)
- type MetaChain
- func (mc *MetaChain) GetCurrentBlockBody() data.BodyHandler
- func (mc *MetaChain) GetCurrentBlockHeader() data.HeaderHandler
- func (mc *MetaChain) GetCurrentBlockHeaderHash() []byte
- func (mc *MetaChain) GetGenesisHeader() data.HeaderHandler
- func (mc *MetaChain) GetGenesisHeaderHash() []byte
- func (mc *MetaChain) GetLocalHeight() int64
- func (mc *MetaChain) GetNetworkHeight() int64
- func (mc *MetaChain) HasBadBlock(blockHash []byte) bool
- func (mc *MetaChain) IsInterfaceNil() bool
- func (mc *MetaChain) PutBadBlock(blockHash []byte)
- func (mc *MetaChain) SetAppStatusHandler(ash core.AppStatusHandler) error
- func (mc *MetaChain) SetCurrentBlockBody(body data.BodyHandler) error
- func (mc *MetaChain) SetCurrentBlockHeader(header data.HeaderHandler) error
- func (mc *MetaChain) SetCurrentBlockHeaderHash(hash []byte)
- func (mc *MetaChain) SetGenesisHeader(header data.HeaderHandler) error
- func (mc *MetaChain) SetGenesisHeaderHash(headerHash []byte)
- func (mc *MetaChain) SetLocalHeight(height int64)
- func (mc *MetaChain) SetNetworkHeight(height int64)
Constants ¶
This section is empty.
Variables ¶
var ErrBadBlocksCacheNil = errors.New("badBlocksCache nil")
ErrBadBlocksCacheNil defines the error for using a nil cache for bad blocks
var ErrHeaderUnitNil = errors.New("header unit nil")
ErrHeaderUnitNil defines the error for using a nil storage unit for block headers
var ErrNilAppStatusHandler = errors.New("nil AppStatusHandler")
ErrNilAppStatusHandler defines the error for setting a nil AppStatusHandler
var ErrWrongTypeInSet = errors.New("wrong type in setter")
ErrWrongTypeInSet defines the error for trying to set the wrong type
Functions ¶
This section is empty.
Types ¶
type BlockChain ¶ added in v1.0.3
type BlockChain struct { GenesisHeader *block.Header // Genesis Block Header pointer CurrentBlockHeader *block.Header // Current Block Header pointer CurrentBlockBody block.Body // Current Block Body pointer // contains filtered or unexported fields }
BlockChain holds the block information for the current shard.
The BlockChain also holds pointers to the Genesis block header, the current block the height of the local chain and the perceived height of the chain in the network.
func NewBlockChain ¶
func NewBlockChain( badBlocksCache storage.Cacher, ) (*BlockChain, error)
NewBlockChain returns an initialized blockchain It uses a config file to setup it's supported storage units map
func (*BlockChain) GetCurrentBlockBody ¶ added in v1.0.3
func (bc *BlockChain) GetCurrentBlockBody() data.BodyHandler
GetCurrentBlockBody returns the tx block body pointer
func (*BlockChain) GetCurrentBlockHeader ¶ added in v1.0.3
func (bc *BlockChain) GetCurrentBlockHeader() data.HeaderHandler
GetCurrentBlockHeader returns current block header pointer
func (*BlockChain) GetCurrentBlockHeaderHash ¶ added in v1.0.3
func (bc *BlockChain) GetCurrentBlockHeaderHash() []byte
GetCurrentBlockHeaderHash returns the current block header hash
func (*BlockChain) GetGenesisHeader ¶ added in v1.0.3
func (bc *BlockChain) GetGenesisHeader() data.HeaderHandler
GetGenesisHeader returns the genesis block header pointer
func (*BlockChain) GetGenesisHeaderHash ¶ added in v1.0.3
func (bc *BlockChain) GetGenesisHeaderHash() []byte
GetGenesisHeaderHash returns the genesis block header hash
func (*BlockChain) GetLocalHeight ¶ added in v1.0.3
func (bc *BlockChain) GetLocalHeight() int64
GetLocalHeight returns the height of the local chain
func (*BlockChain) GetNetworkHeight ¶ added in v1.0.3
func (bc *BlockChain) GetNetworkHeight() int64
GetNetworkHeight sets the perceived height of the network chain
func (*BlockChain) HasBadBlock ¶ added in v1.0.3
func (bc *BlockChain) HasBadBlock(blockHash []byte) bool
HasBadBlock returns true if the provided hash is blacklisted as a bad block, or false otherwise
func (*BlockChain) IsInterfaceNil ¶ added in v1.0.16
func (bc *BlockChain) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*BlockChain) PutBadBlock ¶ added in v1.0.3
func (bc *BlockChain) PutBadBlock(blockHash []byte)
PutBadBlock adds the given serialized block to the bad block cache, blacklisting it
func (*BlockChain) SetAppStatusHandler ¶ added in v1.0.12
func (bc *BlockChain) SetAppStatusHandler(ash core.AppStatusHandler) error
SetAppStatusHandler will set the AppStatusHandler which will be used for monitoring
func (*BlockChain) SetCurrentBlockBody ¶ added in v1.0.3
func (bc *BlockChain) SetCurrentBlockBody(body data.BodyHandler) error
SetCurrentBlockBody sets the tx block body pointer
func (*BlockChain) SetCurrentBlockHeader ¶ added in v1.0.3
func (bc *BlockChain) SetCurrentBlockHeader(header data.HeaderHandler) error
SetCurrentBlockHeader sets current block header pointer
func (*BlockChain) SetCurrentBlockHeaderHash ¶ added in v1.0.3
func (bc *BlockChain) SetCurrentBlockHeaderHash(hash []byte)
SetCurrentBlockHeaderHash returns the current block header hash
func (*BlockChain) SetGenesisHeader ¶ added in v1.0.3
func (bc *BlockChain) SetGenesisHeader(genesisBlock data.HeaderHandler) error
SetGenesisHeader sets the genesis block header pointer
func (*BlockChain) SetGenesisHeaderHash ¶ added in v1.0.3
func (bc *BlockChain) SetGenesisHeaderHash(hash []byte)
SetGenesisHeaderHash sets the genesis block header hash
func (*BlockChain) SetLocalHeight ¶ added in v1.0.3
func (bc *BlockChain) SetLocalHeight(height int64)
SetLocalHeight sets the height of the local chain
func (*BlockChain) SetNetworkHeight ¶ added in v1.0.3
func (bc *BlockChain) SetNetworkHeight(height int64)
SetNetworkHeight sets the perceived height of the network chain
type MetaChain ¶ added in v1.0.3
type MetaChain struct { GenesisBlock *block.MetaBlock // Genesys Block pointer CurrentBlock *block.MetaBlock // Current Block pointer // contains filtered or unexported fields }
MetaChain holds the block information for the beacon chain
The MetaChain also holds pointers to the Genesis block, the current block the height of the local chain and the perceived height of the chain in the network.
func NewMetaChain ¶
NewMetaChain will initialize a new metachain instance
func (*MetaChain) GetCurrentBlockBody ¶ added in v1.0.3
func (mc *MetaChain) GetCurrentBlockBody() data.BodyHandler
GetCurrentBlockBody returns the block body pointer
func (*MetaChain) GetCurrentBlockHeader ¶ added in v1.0.3
func (mc *MetaChain) GetCurrentBlockHeader() data.HeaderHandler
GetCurrentBlockHeader returns current block header pointer
func (*MetaChain) GetCurrentBlockHeaderHash ¶ added in v1.0.3
GetCurrentBlockHeaderHash returns the current block header hash
func (*MetaChain) GetGenesisHeader ¶ added in v1.0.3
func (mc *MetaChain) GetGenesisHeader() data.HeaderHandler
GetGenesisHeader returns the genesis block header pointer
func (*MetaChain) GetGenesisHeaderHash ¶ added in v1.0.3
GetGenesisHeaderHash returns the genesis block header hash
func (*MetaChain) GetLocalHeight ¶ added in v1.0.3
GetLocalHeight returns the height of the local chain
func (*MetaChain) GetNetworkHeight ¶ added in v1.0.3
GetNetworkHeight sets the perceived height of the network chain
func (*MetaChain) HasBadBlock ¶ added in v1.0.3
HasBadBlock returns true if the provided hash is blacklisted as a bad block, or false otherwise
func (*MetaChain) IsInterfaceNil ¶ added in v1.0.16
IsInterfaceNil returns true if there is no value under the interface
func (*MetaChain) PutBadBlock ¶ added in v1.0.3
PutBadBlock adds the given serialized block to the bad block cache, blacklisting it
func (*MetaChain) SetAppStatusHandler ¶ added in v1.0.12
func (mc *MetaChain) SetAppStatusHandler(ash core.AppStatusHandler) error
SetAppStatusHandler will set the AppStatusHandler which will be used for monitoring
func (*MetaChain) SetCurrentBlockBody ¶ added in v1.0.3
func (mc *MetaChain) SetCurrentBlockBody(body data.BodyHandler) error
SetCurrentBlockBody sets the block body pointer
func (*MetaChain) SetCurrentBlockHeader ¶ added in v1.0.3
func (mc *MetaChain) SetCurrentBlockHeader(header data.HeaderHandler) error
SetCurrentBlockHeader sets current block header pointer
func (*MetaChain) SetCurrentBlockHeaderHash ¶ added in v1.0.3
SetCurrentBlockHeaderHash returns the current block header hash
func (*MetaChain) SetGenesisHeader ¶ added in v1.0.3
func (mc *MetaChain) SetGenesisHeader(header data.HeaderHandler) error
SetGenesisHeader returns the genesis block header pointer
func (*MetaChain) SetGenesisHeaderHash ¶ added in v1.0.3
SetGenesisHeaderHash returns the genesis block header hash
func (*MetaChain) SetLocalHeight ¶ added in v1.0.3
SetLocalHeight sets the height of the local chain
func (*MetaChain) SetNetworkHeight ¶ added in v1.0.3
SetNetworkHeight sets the perceived height of the network chain