Documentation ¶
Index ¶
- Constants
- Variables
- type ChainState
- type ConsensusFake
- func (c *ConsensusFake) FinalizeHeader(header *types.PovHeader) error
- func (c *ConsensusFake) Init() error
- func (c *ConsensusFake) PrepareHeader(header *types.PovHeader) error
- func (c *ConsensusFake) Start() error
- func (c *ConsensusFake) Stop() error
- func (c *ConsensusFake) VerifyHeader(header *types.PovHeader) error
- type ConsensusPov
- type ConsensusPow
- func (c *ConsensusPow) FinalizeHeader(header *types.PovHeader) error
- func (c *ConsensusPow) Init() error
- func (c *ConsensusPow) PrepareHeader(header *types.PovHeader) error
- func (c *ConsensusPow) Start() error
- func (c *ConsensusPow) Stop() error
- func (c *ConsensusPow) VerifyHeader(header *types.PovHeader) error
- type EventListener
- type PoVEngine
- func (pov *PoVEngine) AddBlock(block *types.PovBlock, from types.PovBlockFrom, peerID string) error
- func (pov *PoVEngine) AddMinedBlock(block *types.PovBlock) error
- func (pov *PoVEngine) GetAccounts() []*types.Account
- func (pov *PoVEngine) GetChain() *PovBlockChain
- func (pov *PoVEngine) GetConfig() *config.Config
- func (pov *PoVEngine) GetConsensus() ConsensusPov
- func (pov *PoVEngine) GetEventBus() event.EventBus
- func (pov *PoVEngine) GetLedger() ledger.Store
- func (pov *PoVEngine) GetLogger() *zap.SugaredLogger
- func (pov *PoVEngine) GetTxPool() *PovTxPool
- func (pov *PoVEngine) GetVerifier() *PovVerifier
- func (pov *PoVEngine) Init() error
- func (pov *PoVEngine) Start() error
- func (pov *PoVEngine) Stop() error
- type PovBlockChain
- func (bc *PovBlockChain) ApplyTransaction(height uint64, sdb *PovStateDB, stateBlock *types.StateBlock) error
- func (bc *PovBlockChain) CalcBlockReward(header *types.PovHeader) (types.Balance, types.Balance, error)
- func (bc *PovBlockChain) CalcBlockRewardByQLC(header *types.PovHeader) (types.Balance, types.Balance, error)
- func (bc *PovBlockChain) CalcBlockRewardByStakingBonus(header *types.PovHeader) (types.Balance, types.Balance, error)
- func (bc *PovBlockChain) CalcPastMedianTime(prevHeader *types.PovHeader) uint32
- func (bc *PovBlockChain) CalcTotalDifficulty(prevTD *types.PovTD, header *types.PovHeader) *types.PovTD
- func (bc *PovBlockChain) FindAncestor(header *types.PovHeader, height uint64) *types.PovHeader
- func (bc *PovBlockChain) GenStateTrie(height uint64, prevStateHash types.Hash, txs []*types.PovTransaction) (*trie.Trie, error)
- func (bc *PovBlockChain) GenesisBlock() *types.PovBlock
- func (bc *PovBlockChain) GetAccountState(trie *trie.Trie, address types.Address) *types.PovAccountState
- func (bc *PovBlockChain) GetAllOnlineRepStates(header *types.PovHeader) []*types.PovRepState
- func (bc *PovBlockChain) GetBestBlockByHash(hash types.Hash) *types.PovBlock
- func (bc *PovBlockChain) GetBlockByHash(hash types.Hash) *types.PovBlock
- func (bc *PovBlockChain) GetBlockByHeight(height uint64) (*types.PovBlock, error)
- func (bc *PovBlockChain) GetBlockLocator(hash types.Hash) []*types.Hash
- func (bc *PovBlockChain) GetBlockTDByHash(hash types.Hash) *types.PovTD
- func (bc *PovBlockChain) GetBlockTDByHashAndHeight(hash types.Hash, height uint64) *types.PovTD
- func (bc *PovBlockChain) GetDebugInfo() map[string]interface{}
- func (bc *PovBlockChain) GetHeaderByHash(hash types.Hash) *types.PovHeader
- func (bc *PovBlockChain) GetHeaderByHeight(height uint64) *types.PovHeader
- func (bc *PovBlockChain) GetPreviousDayAvgDiffRatio(header *types.PovHeader) (uint64, error)
- func (bc *PovBlockChain) GetRepState(trie *trie.Trie, address types.Address) *types.PovRepState
- func (bc *PovBlockChain) GetStateTrie(stateHash *types.Hash) *trie.Trie
- func (bc *PovBlockChain) HasBestBlock(hash types.Hash, height uint64) bool
- func (bc *PovBlockChain) HasFullBlock(hash types.Hash, height uint64) bool
- func (bc *PovBlockChain) HasHeader(hash types.Hash, height uint64) bool
- func (bc *PovBlockChain) Init() error
- func (bc *PovBlockChain) InsertBlock(block *types.PovBlock, stateTrie *trie.Trie) error
- func (bc *PovBlockChain) IsGenesisBlock(block *types.PovBlock) bool
- func (bc *PovBlockChain) LatestBlock() *types.PovBlock
- func (bc *PovBlockChain) LatestHeader() *types.PovHeader
- func (bc *PovBlockChain) LocateBestBlock(locator []*types.Hash) *types.PovBlock
- func (bc *PovBlockChain) NewStateTrie() *trie.Trie
- func (bc *PovBlockChain) RegisterListener(listener EventListener)
- func (bc *PovBlockChain) RelativeAncestor(header *types.PovHeader, distance uint64) *types.PovHeader
- func (bc *PovBlockChain) ResetChainState() error
- func (bc *PovBlockChain) SetAccountState(trie *trie.Trie, address types.Address, as *types.PovAccountState) error
- func (bc *PovBlockChain) SetRepState(trie *trie.Trie, address types.Address, rs *types.PovRepState) error
- func (bc *PovBlockChain) Start() error
- func (bc *PovBlockChain) Stop() error
- func (bc *PovBlockChain) StoreLatestBlock(block *types.PovBlock)
- func (bc *PovBlockChain) TrieDb() db.Store
- func (bc *PovBlockChain) UnRegisterListener(listener EventListener)
- type PovBlockProcessor
- func (bp *PovBlockProcessor) AddBlock(block *types.PovBlock, from types.PovBlockFrom, peerID string) error
- func (bp *PovBlockProcessor) AddMinedBlock(block *types.PovBlock) error
- func (bp *PovBlockProcessor) GetDebugInfo() map[string]interface{}
- func (bp *PovBlockProcessor) GetNextPendingBlockForDebug() *PovPendingBlock
- func (bp *PovBlockProcessor) GetOrphanRoot(oHash types.Hash) types.Hash
- func (bp *PovBlockProcessor) HasOrphanBlock(blockHash types.Hash) bool
- func (bp *PovBlockProcessor) HasPendingBlock(blockHash types.Hash) bool
- func (bp *PovBlockProcessor) Init() error
- func (bp *PovBlockProcessor) Start() error
- func (bp *PovBlockProcessor) Stop() error
- type PovBlockResult
- type PovBlockSource
- type PovConsensusChainReader
- type PovOrphanBlock
- type PovPendingBlock
- type PovProcessorChainReader
- type PovProcessorSyncer
- type PovProcessorVerifier
- type PovStateDB
- func (sdb *PovStateDB) CommitToTrie() error
- func (sdb *PovStateDB) GetAccountState(address types.Address) (*types.PovAccountState, error)
- func (sdb *PovStateDB) GetRepState(address types.Address) (*types.PovRepState, error)
- func (sdb *PovStateDB) SetAccountState(address types.Address, as *types.PovAccountState) error
- func (sdb *PovStateDB) SetRepState(address types.Address, rs *types.PovRepState) error
- type PovSyncBlock
- type PovSyncEvent
- type PovSyncMessage
- type PovSyncPeer
- type PovSyncPeerSetByHeight
- type PovSyncPeerSetByTD
- type PovSyncer
- func (ss *PovSyncer) FindPeer(peerID string) *PovSyncPeer
- func (ss *PovSyncer) FindPeerWithStatus(peerID string, status int) *PovSyncPeer
- func (ss *PovSyncer) GetBestPeer(lastPeerID string) *PovSyncPeer
- func (ss *PovSyncer) GetBestPeers(limit int) []*PovSyncPeer
- func (ss *PovSyncer) GetDebugInfo() map[string]interface{}
- func (ss *PovSyncer) GetPeerLocators() []*PovSyncPeer
- func (ss *PovSyncer) GetRandomPeers(limit int) []*PovSyncPeer
- func (ss *PovSyncer) GetRandomTopPeer(top int) *PovSyncPeer
- func (ss *PovSyncer) PeerCount() int
- func (ss *PovSyncer) PeerCountWithStatus(status int) int
- func (ss *PovSyncer) Start() error
- func (ss *PovSyncer) Stop()
- type PovSyncerChainReader
- type PovTxChainReader
- type PovTxEntry
- type PovTxEvent
- type PovTxPendingEntry
- type PovTxPool
- func (tp *PovTxPool) GetDebugInfo() map[string]interface{}
- func (tp *PovTxPool) GetPendingTxNum() uint32
- func (tp *PovTxPool) Init() error
- func (tp *PovTxPool) LastUpdated() time.Time
- func (tp *PovTxPool) OnPovBlockEvent(evt byte, block *types.PovBlock)
- func (tp *PovTxPool) SelectPendingTxs(stateTrie *trie.Trie, limit int) []*types.StateBlock
- func (tp *PovTxPool) Start() error
- func (tp *PovTxPool) Stop()
- type PovVerifier
- func (pv *PovVerifier) BlockCheck(block types.Block) (process.ProcessResult, error)
- func (pv *PovVerifier) Process(block types.Block) (process.ProcessResult, error)
- func (pv *PovVerifier) VerifyFull(block *types.PovBlock) *PovVerifyStat
- func (pv *PovVerifier) VerifyNet(block *types.PovBlock) *PovVerifyStat
- type PovVerifierChainReader
- type PovVerifyStat
Constants ¶
View Source
const ( PovConsensusModeFake = iota PovConsensusModePow )
View Source
const ( EventConnectPovBlock = byte(1) EventDisconnectPovBlock = byte(2) )
View Source
const (
MaxTxsInPool = 1000000
)
Variables ¶
View Source
var ( ErrPovInvalidHash = errors.New("invalid pov block hash") ErrPovNoGenesis = errors.New("pov genesis block not found in chain") ErrPovUnknownAncestor = errors.New("unknown pov block ancestor") ErrPovFutureBlock = errors.New("pov block in the future") ErrPovInvalidHeight = errors.New("invalid pov block height") ErrPovInvalidPrevious = errors.New("invalid pov block previous") ErrPovFailedVerify = errors.New("failed to verify block") ErrPovForkHashZero = errors.New("fork point hash is zero") ErrPovInvalidHead = errors.New("invalid pov head block") ErrPovInvalidFork = errors.New("invalid pov fork point") )
Functions ¶
This section is empty.
Types ¶
type ChainState ¶
type ChainState uint
const ( ChainStateNone ChainState = iota ChainStateMain ChainStateSide )
func (ChainState) String ¶
func (s ChainState) String() string
type ConsensusFake ¶
type ConsensusFake struct {
// contains filtered or unexported fields
}
func NewConsensusFake ¶
func NewConsensusFake(chainR PovConsensusChainReader) *ConsensusFake
func (*ConsensusFake) FinalizeHeader ¶
func (c *ConsensusFake) FinalizeHeader(header *types.PovHeader) error
func (*ConsensusFake) Init ¶
func (c *ConsensusFake) Init() error
func (*ConsensusFake) PrepareHeader ¶
func (c *ConsensusFake) PrepareHeader(header *types.PovHeader) error
func (*ConsensusFake) Start ¶
func (c *ConsensusFake) Start() error
func (*ConsensusFake) Stop ¶
func (c *ConsensusFake) Stop() error
func (*ConsensusFake) VerifyHeader ¶
func (c *ConsensusFake) VerifyHeader(header *types.PovHeader) error
type ConsensusPov ¶
type ConsensusPov interface { Init() error Start() error Stop() error PrepareHeader(header *types.PovHeader) error FinalizeHeader(header *types.PovHeader) error VerifyHeader(header *types.PovHeader) error }
func NewPovConsensus ¶
func NewPovConsensus(mode int, chainR PovConsensusChainReader) ConsensusPov
type ConsensusPow ¶
type ConsensusPow struct {
// contains filtered or unexported fields
}
func NewConsensusPow ¶
func NewConsensusPow(chainR PovConsensusChainReader) *ConsensusPow
func (*ConsensusPow) FinalizeHeader ¶
func (c *ConsensusPow) FinalizeHeader(header *types.PovHeader) error
func (*ConsensusPow) Init ¶
func (c *ConsensusPow) Init() error
func (*ConsensusPow) PrepareHeader ¶
func (c *ConsensusPow) PrepareHeader(header *types.PovHeader) error
func (*ConsensusPow) Start ¶
func (c *ConsensusPow) Start() error
func (*ConsensusPow) Stop ¶
func (c *ConsensusPow) Stop() error
func (*ConsensusPow) VerifyHeader ¶
func (c *ConsensusPow) VerifyHeader(header *types.PovHeader) error
type EventListener ¶ added in v1.2.4
type PoVEngine ¶
type PoVEngine struct {
// contains filtered or unexported fields
}
func NewPovEngine ¶
func (*PoVEngine) GetAccounts ¶
func (*PoVEngine) GetChain ¶
func (pov *PoVEngine) GetChain() *PovBlockChain
func (*PoVEngine) GetConsensus ¶
func (pov *PoVEngine) GetConsensus() ConsensusPov
func (*PoVEngine) GetEventBus ¶
func (*PoVEngine) GetLogger ¶
func (pov *PoVEngine) GetLogger() *zap.SugaredLogger
func (*PoVEngine) GetVerifier ¶
func (pov *PoVEngine) GetVerifier() *PovVerifier
type PovBlockChain ¶
type PovBlockChain struct {
// contains filtered or unexported fields
}
func NewPovBlockChain ¶
func (*PovBlockChain) ApplyTransaction ¶
func (bc *PovBlockChain) ApplyTransaction(height uint64, sdb *PovStateDB, stateBlock *types.StateBlock) error
func (*PovBlockChain) CalcBlockReward ¶ added in v1.3.0
func (*PovBlockChain) CalcBlockRewardByQLC ¶ added in v1.3.0
func (*PovBlockChain) CalcBlockRewardByStakingBonus ¶ added in v1.3.1
func (*PovBlockChain) CalcPastMedianTime ¶
func (bc *PovBlockChain) CalcPastMedianTime(prevHeader *types.PovHeader) uint32
func (*PovBlockChain) CalcTotalDifficulty ¶
func (*PovBlockChain) FindAncestor ¶
func (*PovBlockChain) GenStateTrie ¶
func (bc *PovBlockChain) GenStateTrie(height uint64, prevStateHash types.Hash, txs []*types.PovTransaction) (*trie.Trie, error)
func (*PovBlockChain) GenesisBlock ¶
func (bc *PovBlockChain) GenesisBlock() *types.PovBlock
func (*PovBlockChain) GetAccountState ¶
func (bc *PovBlockChain) GetAccountState(trie *trie.Trie, address types.Address) *types.PovAccountState
func (*PovBlockChain) GetAllOnlineRepStates ¶ added in v1.3.0
func (bc *PovBlockChain) GetAllOnlineRepStates(header *types.PovHeader) []*types.PovRepState
func (*PovBlockChain) GetBestBlockByHash ¶
func (bc *PovBlockChain) GetBestBlockByHash(hash types.Hash) *types.PovBlock
func (*PovBlockChain) GetBlockByHash ¶
func (bc *PovBlockChain) GetBlockByHash(hash types.Hash) *types.PovBlock
func (*PovBlockChain) GetBlockByHeight ¶
func (bc *PovBlockChain) GetBlockByHeight(height uint64) (*types.PovBlock, error)
func (*PovBlockChain) GetBlockLocator ¶
func (bc *PovBlockChain) GetBlockLocator(hash types.Hash) []*types.Hash
func (*PovBlockChain) GetBlockTDByHash ¶
func (bc *PovBlockChain) GetBlockTDByHash(hash types.Hash) *types.PovTD
func (*PovBlockChain) GetBlockTDByHashAndHeight ¶
func (*PovBlockChain) GetDebugInfo ¶ added in v1.3.0
func (bc *PovBlockChain) GetDebugInfo() map[string]interface{}
func (*PovBlockChain) GetHeaderByHash ¶
func (bc *PovBlockChain) GetHeaderByHash(hash types.Hash) *types.PovHeader
func (*PovBlockChain) GetHeaderByHeight ¶
func (bc *PovBlockChain) GetHeaderByHeight(height uint64) *types.PovHeader
func (*PovBlockChain) GetPreviousDayAvgDiffRatio ¶ added in v1.3.1
func (bc *PovBlockChain) GetPreviousDayAvgDiffRatio(header *types.PovHeader) (uint64, error)
func (*PovBlockChain) GetRepState ¶ added in v1.3.0
func (bc *PovBlockChain) GetRepState(trie *trie.Trie, address types.Address) *types.PovRepState
func (*PovBlockChain) GetStateTrie ¶
func (bc *PovBlockChain) GetStateTrie(stateHash *types.Hash) *trie.Trie
func (*PovBlockChain) HasBestBlock ¶
func (bc *PovBlockChain) HasBestBlock(hash types.Hash, height uint64) bool
func (*PovBlockChain) HasFullBlock ¶
func (bc *PovBlockChain) HasFullBlock(hash types.Hash, height uint64) bool
func (*PovBlockChain) HasHeader ¶
func (bc *PovBlockChain) HasHeader(hash types.Hash, height uint64) bool
func (*PovBlockChain) Init ¶
func (bc *PovBlockChain) Init() error
func (*PovBlockChain) InsertBlock ¶
func (*PovBlockChain) IsGenesisBlock ¶
func (bc *PovBlockChain) IsGenesisBlock(block *types.PovBlock) bool
func (*PovBlockChain) LatestBlock ¶
func (bc *PovBlockChain) LatestBlock() *types.PovBlock
func (*PovBlockChain) LatestHeader ¶
func (bc *PovBlockChain) LatestHeader() *types.PovHeader
func (*PovBlockChain) LocateBestBlock ¶
func (bc *PovBlockChain) LocateBestBlock(locator []*types.Hash) *types.PovBlock
func (*PovBlockChain) NewStateTrie ¶
func (bc *PovBlockChain) NewStateTrie() *trie.Trie
func (*PovBlockChain) RegisterListener ¶ added in v1.2.4
func (bc *PovBlockChain) RegisterListener(listener EventListener)
func (*PovBlockChain) RelativeAncestor ¶
func (*PovBlockChain) ResetChainState ¶
func (bc *PovBlockChain) ResetChainState() error
func (*PovBlockChain) SetAccountState ¶
func (bc *PovBlockChain) SetAccountState(trie *trie.Trie, address types.Address, as *types.PovAccountState) error
func (*PovBlockChain) SetRepState ¶ added in v1.3.0
func (bc *PovBlockChain) SetRepState(trie *trie.Trie, address types.Address, rs *types.PovRepState) error
func (*PovBlockChain) Start ¶
func (bc *PovBlockChain) Start() error
func (*PovBlockChain) Stop ¶
func (bc *PovBlockChain) Stop() error
func (*PovBlockChain) StoreLatestBlock ¶
func (bc *PovBlockChain) StoreLatestBlock(block *types.PovBlock)
func (*PovBlockChain) TrieDb ¶
func (bc *PovBlockChain) TrieDb() db.Store
func (*PovBlockChain) UnRegisterListener ¶ added in v1.2.4
func (bc *PovBlockChain) UnRegisterListener(listener EventListener)
type PovBlockProcessor ¶
type PovBlockProcessor struct {
// contains filtered or unexported fields
}
func NewPovBlockProcessor ¶
func NewPovBlockProcessor(eb event.EventBus, l ledger.Store, chain PovProcessorChainReader, verifier PovProcessorVerifier, syncer PovProcessorSyncer) *PovBlockProcessor
func (*PovBlockProcessor) AddBlock ¶
func (bp *PovBlockProcessor) AddBlock(block *types.PovBlock, from types.PovBlockFrom, peerID string) error
func (*PovBlockProcessor) AddMinedBlock ¶
func (bp *PovBlockProcessor) AddMinedBlock(block *types.PovBlock) error
func (*PovBlockProcessor) GetDebugInfo ¶ added in v1.3.0
func (bp *PovBlockProcessor) GetDebugInfo() map[string]interface{}
func (*PovBlockProcessor) GetNextPendingBlockForDebug ¶ added in v1.3.0
func (bp *PovBlockProcessor) GetNextPendingBlockForDebug() *PovPendingBlock
func (*PovBlockProcessor) GetOrphanRoot ¶
func (bp *PovBlockProcessor) GetOrphanRoot(oHash types.Hash) types.Hash
func (*PovBlockProcessor) HasOrphanBlock ¶
func (bp *PovBlockProcessor) HasOrphanBlock(blockHash types.Hash) bool
func (*PovBlockProcessor) HasPendingBlock ¶
func (bp *PovBlockProcessor) HasPendingBlock(blockHash types.Hash) bool
func (*PovBlockProcessor) Init ¶
func (bp *PovBlockProcessor) Init() error
func (*PovBlockProcessor) Start ¶
func (bp *PovBlockProcessor) Start() error
func (*PovBlockProcessor) Stop ¶
func (bp *PovBlockProcessor) Stop() error
type PovBlockResult ¶
type PovBlockResult struct {
// contains filtered or unexported fields
}
type PovBlockSource ¶
type PovBlockSource struct {
// contains filtered or unexported fields
}
type PovConsensusChainReader ¶
type PovConsensusChainReader interface { GetHeaderByHash(hash types.Hash) *types.PovHeader RelativeAncestor(header *types.PovHeader, distance uint64) *types.PovHeader GetStateTrie(stateHash *types.Hash) *trie.Trie GetAccountState(trie *trie.Trie, address types.Address) *types.PovAccountState GetRepState(trie *trie.Trie, address types.Address) *types.PovRepState }
type PovOrphanBlock ¶
type PovOrphanBlock struct {
// contains filtered or unexported fields
}
type PovPendingBlock ¶
type PovPendingBlock struct {
// contains filtered or unexported fields
}
type PovProcessorChainReader ¶ added in v1.2.4
type PovProcessorSyncer ¶ added in v1.2.4
type PovProcessorSyncer interface {
// contains filtered or unexported methods
}
type PovProcessorVerifier ¶ added in v1.2.4
type PovProcessorVerifier interface {
VerifyFull(block *types.PovBlock) *PovVerifyStat
}
type PovStateDB ¶ added in v1.3.1
type PovStateDB struct {
// contains filtered or unexported fields
}
func NewPovStateDB ¶ added in v1.3.1
func NewPovStateDB(t *trie.Trie) *PovStateDB
func (*PovStateDB) CommitToTrie ¶ added in v1.3.1
func (sdb *PovStateDB) CommitToTrie() error
func (*PovStateDB) GetAccountState ¶ added in v1.3.1
func (sdb *PovStateDB) GetAccountState(address types.Address) (*types.PovAccountState, error)
func (*PovStateDB) GetRepState ¶ added in v1.3.1
func (sdb *PovStateDB) GetRepState(address types.Address) (*types.PovRepState, error)
func (*PovStateDB) SetAccountState ¶ added in v1.3.1
func (sdb *PovStateDB) SetAccountState(address types.Address, as *types.PovAccountState) error
func (*PovStateDB) SetRepState ¶ added in v1.3.1
func (sdb *PovStateDB) SetRepState(address types.Address, rs *types.PovRepState) error
type PovSyncBlock ¶ added in v1.3.0
type PovSyncEvent ¶
type PovSyncEvent struct {
// contains filtered or unexported fields
}
type PovSyncMessage ¶
type PovSyncMessage struct {
// contains filtered or unexported fields
}
type PovSyncPeer ¶
type PovSyncPeer struct {
// contains filtered or unexported fields
}
type PovSyncPeerSetByHeight ¶
type PovSyncPeerSetByHeight []*PovSyncPeer
func (PovSyncPeerSetByHeight) Len ¶
func (s PovSyncPeerSetByHeight) Len() int
func (PovSyncPeerSetByHeight) Less ¶
func (s PovSyncPeerSetByHeight) Less(i, j int) bool
func (PovSyncPeerSetByHeight) Swap ¶
func (s PovSyncPeerSetByHeight) Swap(i, j int)
type PovSyncPeerSetByTD ¶
type PovSyncPeerSetByTD []*PovSyncPeer
PeerSetByTD is in descend order
func (PovSyncPeerSetByTD) Len ¶
func (s PovSyncPeerSetByTD) Len() int
func (PovSyncPeerSetByTD) Less ¶
func (s PovSyncPeerSetByTD) Less(i, j int) bool
func (PovSyncPeerSetByTD) Swap ¶
func (s PovSyncPeerSetByTD) Swap(i, j int)
type PovSyncer ¶
type PovSyncer struct {
// contains filtered or unexported fields
}
func NewPovSyncer ¶
func (*PovSyncer) FindPeer ¶
func (ss *PovSyncer) FindPeer(peerID string) *PovSyncPeer
func (*PovSyncer) FindPeerWithStatus ¶
func (ss *PovSyncer) FindPeerWithStatus(peerID string, status int) *PovSyncPeer
func (*PovSyncer) GetBestPeer ¶
func (ss *PovSyncer) GetBestPeer(lastPeerID string) *PovSyncPeer
func (*PovSyncer) GetBestPeers ¶
func (ss *PovSyncer) GetBestPeers(limit int) []*PovSyncPeer
func (*PovSyncer) GetDebugInfo ¶ added in v1.3.0
func (*PovSyncer) GetPeerLocators ¶
func (ss *PovSyncer) GetPeerLocators() []*PovSyncPeer
func (*PovSyncer) GetRandomPeers ¶
func (ss *PovSyncer) GetRandomPeers(limit int) []*PovSyncPeer
func (*PovSyncer) GetRandomTopPeer ¶
func (ss *PovSyncer) GetRandomTopPeer(top int) *PovSyncPeer
GetRandomTopPeer select one peer from top peers
func (*PovSyncer) PeerCountWithStatus ¶
type PovSyncerChainReader ¶ added in v1.3.0
type PovTxChainReader ¶ added in v1.2.4
type PovTxChainReader interface { RegisterListener(listener EventListener) UnRegisterListener(listener EventListener) GetAccountState(trie *trie.Trie, address types.Address) *types.PovAccountState }
type PovTxEntry ¶
type PovTxEntry struct {
// contains filtered or unexported fields
}
type PovTxEvent ¶
type PovTxEvent struct {
// contains filtered or unexported fields
}
type PovTxPendingEntry ¶
type PovTxPendingEntry struct {
// contains filtered or unexported fields
}
type PovTxPool ¶
type PovTxPool struct {
// contains filtered or unexported fields
}
func NewPovTxPool ¶
func (*PovTxPool) GetDebugInfo ¶ added in v1.3.0
func (*PovTxPool) GetPendingTxNum ¶ added in v1.3.0
func (*PovTxPool) LastUpdated ¶
func (*PovTxPool) OnPovBlockEvent ¶ added in v1.2.4
func (*PovTxPool) SelectPendingTxs ¶
type PovVerifier ¶
type PovVerifier struct {
// contains filtered or unexported fields
}
func NewPovVerifier ¶
func NewPovVerifier(store ledger.Store, chain PovVerifierChainReader, cs ConsensusPov) *PovVerifier
func (*PovVerifier) BlockCheck ¶
func (pv *PovVerifier) BlockCheck(block types.Block) (process.ProcessResult, error)
func (*PovVerifier) Process ¶
func (pv *PovVerifier) Process(block types.Block) (process.ProcessResult, error)
func (*PovVerifier) VerifyFull ¶
func (pv *PovVerifier) VerifyFull(block *types.PovBlock) *PovVerifyStat
func (*PovVerifier) VerifyNet ¶
func (pv *PovVerifier) VerifyNet(block *types.PovBlock) *PovVerifyStat
type PovVerifierChainReader ¶
type PovVerifierChainReader interface { GetHeaderByHash(hash types.Hash) *types.PovHeader CalcPastMedianTime(prevHeader *types.PovHeader) uint32 GenStateTrie(height uint64, prevStateHash types.Hash, txs []*types.PovTransaction) (*trie.Trie, error) GetStateTrie(stateHash *types.Hash) *trie.Trie GetAccountState(trie *trie.Trie, address types.Address) *types.PovAccountState CalcBlockReward(header *types.PovHeader) (types.Balance, types.Balance, error) }
type PovVerifyStat ¶
type PovVerifyStat struct { Result process.ProcessResult ErrMsg string GapTxs map[types.Hash]process.ProcessResult CurHeader *types.PovHeader PrevHeader *types.PovHeader PrevStateTrie *trie.Trie StateTrie *trie.Trie TxBlocks map[types.Hash]*types.StateBlock }
func NewPovVerifyStat ¶
func NewPovVerifyStat() *PovVerifyStat
Click to show internal directories.
Click to hide internal directories.