Documentation ¶
Overview ¶
Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Index ¶
- type HistoryFlag
- type RoundManager
- func (m *RoundManager) GetContract() common.Address
- func (m *RoundManager) GetHsMappingByRound(round uint32) (map[string]*ainterface.ValidatorInfo, error)
- func (m *RoundManager) GetMinersByRound(round uint32) (map[string]float64, error)
- func (m *RoundManager) GetNextRound(round *ainterface.Round) (*ainterface.Round, error)
- func (m *RoundManager) GetRoundInterval(round int64) int64
- func (m *RoundManager) GetValidators(blockHash common.Hash, round uint32, fn ainterface.GetValidatorsCallBack) ([]*common.Address, map[common.Address]uint16, error)
- func (m *RoundManager) Halt()
- func (m *RoundManager) HasValidator(validator common.Address) bool
- func (m *RoundManager) Init(round uint32, db database.Transactor, c ainterface.IBtcClient) error
- func (m *RoundManager) Start()
- type RoundMinerInfo
- type RoundValidators
- type SPService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HistoryFlag ¶
type HistoryFlag byte
const ( // CacheSize represents the size of cache for round validators. CacheSize = 8 ExistFlag HistoryFlag = 1 SaveFlag HistoryFlag = 2 NoneFlag HistoryFlag = 0 )
type RoundManager ¶
type RoundManager struct {
// contains filtered or unexported fields
}
func (*RoundManager) GetContract ¶
func (m *RoundManager) GetContract() common.Address
return unique contract code which represents some consensus
func (*RoundManager) GetHsMappingByRound ¶
func (m *RoundManager) GetHsMappingByRound(round uint32) (map[string]*ainterface.ValidatorInfo, error)
func (*RoundManager) GetMinersByRound ¶
func (m *RoundManager) GetMinersByRound(round uint32) (map[string]float64, error)
get miners of round the return value is a map (key (miner) -> value (count per collect interval))
func (*RoundManager) GetNextRound ¶
func (m *RoundManager) GetNextRound(round *ainterface.Round) (*ainterface.Round, error)
return the next round.
func (*RoundManager) GetRoundInterval ¶
func (m *RoundManager) GetRoundInterval(round int64) int64
get special round interval
func (*RoundManager) GetValidators ¶
func (m *RoundManager) GetValidators(blockHash common.Hash, round uint32, fn ainterface.GetValidatorsCallBack) ( []*common.Address, map[common.Address]uint16, error)
Get validators for special round.
func (*RoundManager) Halt ¶
func (m *RoundManager) Halt()
func (*RoundManager) HasValidator ¶
func (m *RoundManager) HasValidator(validator common.Address) bool
return true if the given validator may be valid, other wise false.
func (*RoundManager) Init ¶
func (m *RoundManager) Init(round uint32, db database.Transactor, c ainterface.IBtcClient) error
initialize round manager.
func (*RoundManager) Start ¶
func (m *RoundManager) Start()
type RoundMinerInfo ¶
type RoundMinerInfo struct {
// contains filtered or unexported fields
}
type RoundValidators ¶
type RoundValidators struct {
// contains filtered or unexported fields
}
type SPService ¶
Prove of SatoshiPlus. using round robin algorithm to generate blocks with orders in the list of authority peers. this consensus depends on bitcoin's miner. please refer to the white paper of asimov.
func NewSatoshiPlusService ¶
Create SatoshiPlus Service
func (*SPService) GetRoundInterval ¶
return round interval currently