Fixes and debug added
This commit is contained in:
		| @@ -114,10 +114,6 @@ func main() { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	if StartMining { | ||||
| 		ethereum.Miner().Start() | ||||
| 	} | ||||
|  | ||||
| 	if len(ImportChain) > 0 { | ||||
| 		start := time.Now() | ||||
| 		err := utils.ImportChain(ethereum, ImportChain) | ||||
|   | ||||
| @@ -42,11 +42,16 @@ func (self *CpuMiner) Start() { | ||||
| } | ||||
|  | ||||
| func (self *CpuMiner) update() { | ||||
| 	justStarted := true | ||||
| out: | ||||
| 	for { | ||||
| 		select { | ||||
| 		case block := <-self.c: | ||||
| 			self.quitCurrentOp <- struct{}{} | ||||
| 			if justStarted { | ||||
| 				justStarted = true | ||||
| 			} else { | ||||
| 				self.quitCurrentOp <- struct{}{} | ||||
| 			} | ||||
|  | ||||
| 			go self.mine(block) | ||||
| 		case <-self.quit: | ||||
|   | ||||
| @@ -29,6 +29,7 @@ func New(coinbase []byte, eth core.Backend, pow pow.PoW, minerThreads int) *Mine | ||||
| 		pow:      pow, | ||||
| 	} | ||||
|  | ||||
| 	minerThreads = 1 | ||||
| 	for i := 0; i < minerThreads; i++ { | ||||
| 		miner.worker.register(NewCpuMiner(i, miner.pow)) | ||||
| 	} | ||||
|   | ||||
| @@ -151,10 +151,10 @@ func (self *worker) wait() { | ||||
| 				self.current.block.Header().Nonce = work.Nonce | ||||
| 				self.current.block.Header().MixDigest = work.MixDigest | ||||
| 				self.current.block.Header().SeedHash = work.SeedHash | ||||
| 				fmt.Println(self.current.block) | ||||
|  | ||||
| 				if err := self.chain.InsertChain(types.Blocks{self.current.block}); err == nil { | ||||
| 					self.mux.Post(core.NewMinedBlockEvent{self.current.block}) | ||||
| 					fmt.Println("GOOD BLOCK", self.current.block) | ||||
| 				} else { | ||||
| 					self.commitNewWork() | ||||
| 				} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user