wip
This commit is contained in:
		@@ -205,7 +205,7 @@ func New(config *Config) (*Ethereum, error) {
 | 
			
		||||
	ethProto := EthProtocol(config.ProtocolVersion, config.NetworkId, eth.txPool, eth.chainManager, eth.blockPool)
 | 
			
		||||
	protocols := []p2p.Protocol{ethProto}
 | 
			
		||||
	if config.Shh {
 | 
			
		||||
		protocols = append(protocols, eth.whisper.Protocol())
 | 
			
		||||
		//protocols = append(protocols, eth.whisper.Protocol())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	eth.net = &p2p.Server{
 | 
			
		||||
 
 | 
			
		||||
@@ -79,3 +79,7 @@ func (self *CpuMiner) mine(block *types.Block) {
 | 
			
		||||
		self.returnCh <- Work{block.Number().Uint64(), nonce, mixDigest, seedHash}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (self *CpuMiner) GetHashRate() int64 {
 | 
			
		||||
	return self.pow.GetHashrate()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ type Agent interface {
 | 
			
		||||
	SetWorkCh(chan<- Work)
 | 
			
		||||
	Stop()
 | 
			
		||||
	Start()
 | 
			
		||||
	Pow() pow.PoW
 | 
			
		||||
	GetHashRate() int64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type worker struct {
 | 
			
		||||
@@ -272,7 +272,7 @@ func (self *worker) commitTransaction(tx *types.Transaction) error {
 | 
			
		||||
func (self *worker) HashRate() int64 {
 | 
			
		||||
	var tot int64
 | 
			
		||||
	for _, agent := range self.agents {
 | 
			
		||||
		tot += agent.Pow().GetHashrate()
 | 
			
		||||
		tot += agent.GetHashRate()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return tot
 | 
			
		||||
 
 | 
			
		||||
@@ -488,3 +488,11 @@ func toFilterOptions(options *BlockFilterArgs) *core.FilterOptions {
 | 
			
		||||
 | 
			
		||||
	return &opts
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
	Work() chan<- *types.Block
 | 
			
		||||
	SetWorkCh(chan<- Work)
 | 
			
		||||
	Stop()
 | 
			
		||||
	Start()
 | 
			
		||||
	Rate() uint64
 | 
			
		||||
*/
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user