Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMineMaster ¶
func MakeMineMaster(config MineConfig) (Master, MasterServer)
context must have coinbaseAddress common.Address, workBuilder workBuilder, blockBuilder blockBuilder, blockSubmitter blockSubmitter) (Master, MasterServer make a mine master
Types ¶
type BlockBroadcaster ¶
type BlockBroadcaster interface {
BroadcastMinedBlock(block model.AbstractBlock)
}
type BlockBuilder ¶
type BlockBuilder interface {
BuildWaitPackBlock(coinbaseAddr common.Address) model.AbstractBlock
}
type Master ¶
type Master interface { Start() Stop() CurrentCoinbaseAddress() common.Address SetCoinbaseAddress(addr common.Address) OnNewBlock(block model.AbstractBlock) Workers() map[WorkerId]WorkerForMaster GetReward(address common.Address) *big.Int GetPerformance(address common.Address) uint64 // whether the mining is ongoing Mining() bool // cur mine block tx count MineTxCount() int SpendableMaster }
type MasterServer ¶
type MasterServer interface { RegisterWorker(worker WorkerForMaster) UnRegisterWorker(workerId WorkerId) ReceiveMsg(workerID WorkerId, code uint64, msg interface{}) // for p2p msg OnNewMsg(msg p2p.Msg, p chain_communication.PmAbstractPeer) error // only for worker, do nothing SetMineMasterPeer(peer chain_communication.PmAbstractPeer) }
type MineConfig ¶
type MineConfig struct { CoinbaseAddress *atomic.Value BlockBuilder BlockBuilder BlockBroadcaster BlockBroadcaster }
func (*MineConfig) GetCoinbaseAddr ¶
func (conf *MineConfig) GetCoinbaseAddr() (result common.Address)
type SpendableMaster ¶
type WorkerForMaster ¶
Click to show internal directories.
Click to hide internal directories.