This commit is contained in:
obscuren 2015-03-20 17:42:09 +01:00
parent a59bb053f4
commit 54dac59285
4 changed files with 15 additions and 3 deletions

View File

@ -205,7 +205,7 @@ func New(config *Config) (*Ethereum, error) {
ethProto := EthProtocol(config.ProtocolVersion, config.NetworkId, eth.txPool, eth.chainManager, eth.blockPool) ethProto := EthProtocol(config.ProtocolVersion, config.NetworkId, eth.txPool, eth.chainManager, eth.blockPool)
protocols := []p2p.Protocol{ethProto} protocols := []p2p.Protocol{ethProto}
if config.Shh { if config.Shh {
protocols = append(protocols, eth.whisper.Protocol()) //protocols = append(protocols, eth.whisper.Protocol())
} }
eth.net = &p2p.Server{ eth.net = &p2p.Server{

View File

@ -79,3 +79,7 @@ func (self *CpuMiner) mine(block *types.Block) {
self.returnCh <- Work{block.Number().Uint64(), nonce, mixDigest, seedHash} self.returnCh <- Work{block.Number().Uint64(), nonce, mixDigest, seedHash}
} }
} }
func (self *CpuMiner) GetHashRate() int64 {
return self.pow.GetHashrate()
}

View File

@ -57,7 +57,7 @@ type Agent interface {
SetWorkCh(chan<- Work) SetWorkCh(chan<- Work)
Stop() Stop()
Start() Start()
Pow() pow.PoW GetHashRate() int64
} }
type worker struct { type worker struct {
@ -272,7 +272,7 @@ func (self *worker) commitTransaction(tx *types.Transaction) error {
func (self *worker) HashRate() int64 { func (self *worker) HashRate() int64 {
var tot int64 var tot int64
for _, agent := range self.agents { for _, agent := range self.agents {
tot += agent.Pow().GetHashrate() tot += agent.GetHashRate()
} }
return tot return tot

View File

@ -488,3 +488,11 @@ func toFilterOptions(options *BlockFilterArgs) *core.FilterOptions {
return &opts return &opts
} }
/*
Work() chan<- *types.Block
SetWorkCh(chan<- Work)
Stop()
Start()
Rate() uint64
*/