core, miner: implemented canary

This commit is contained in:
Jeffrey Wilcke
2015-06-29 12:42:47 +02:00
parent d1e93db3eb
commit b39042db56
2 changed files with 34 additions and 0 deletions

View File

@ -267,6 +267,12 @@ func (self *worker) wait() {
func (self *worker) push() {
if atomic.LoadInt32(&self.mining) == 1 {
if core.Canary(self.current.state) {
glog.Infoln("Toxicity levels rising to deadly levels. Your canary has died. You can go back or continue down the mineshaft --more--")
glog.Infoln("You turn back and abort mining")
return
}
self.current.state.Sync()
self.current.block.SetRoot(self.current.state.Root())