aboutsummaryrefslogtreecommitdiffstats
path: root/ethminer
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-29 18:36:27 +0800
committerobscuren <geffobscura@gmail.com>2014-04-29 18:36:27 +0800
commit38d6b67b5cfbfb63620a244ea01b5b534917128f (patch)
tree42b4f55e4cd5c2f2a2c28f8551d8b92686abf567 /ethminer
parent5516efdfa0494e028fc3649e4a38da81c56ed598 (diff)
downloadgo-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar.gz
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.tar.zst
go-tangerine-38d6b67b5cfbfb63620a244ea01b5b534917128f.zip
Fixed state problem
Diffstat (limited to 'ethminer')
-rw-r--r--ethminer/miner.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/ethminer/miner.go b/ethminer/miner.go
index 791e8e402..c93267161 100644
--- a/ethminer/miner.go
+++ b/ethminer/miner.go
@@ -2,6 +2,7 @@ package ethminer
import (
"bytes"
+ "fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
@@ -61,10 +62,10 @@ func (miner *Miner) listener() {
select {
case chanMessage := <-miner.reactChan:
if block, ok := chanMessage.Resource.(*ethchain.Block); ok {
- //log.Println("[MINER] Got new block via Reactor")
+ log.Println("[MINER] Got new block via Reactor")
if bytes.Compare(miner.ethereum.BlockChain().CurrentBlock.Hash(), block.Hash()) == 0 {
// TODO: Perhaps continue mining to get some uncle rewards
- //log.Println("[MINER] New top block found resetting state")
+ log.Println("[MINER] New top block found resetting state")
// Filter out which Transactions we have that were not in this block
var newtxs []*ethchain.Transaction
@@ -86,7 +87,7 @@ func (miner *Miner) listener() {
} else {
if bytes.Compare(block.PrevHash, miner.ethereum.BlockChain().CurrentBlock.PrevHash) == 0 {
- //log.Println("[MINER] Adding uncle block")
+ log.Println("[MINER] Adding uncle block")
miner.uncles = append(miner.uncles, block)
miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
}
@@ -133,8 +134,9 @@ func (miner *Miner) listener() {
miner.ethereum.StateManager().PrepareDefault(miner.block)
err := miner.ethereum.StateManager().ProcessBlock(miner.block, true)
if err != nil {
- log.Println("Error result from process block:", err)
- miner.block.State().Reset()
+ log.Println(err)
+ miner.txs = []*ethchain.Transaction{} // Move this somewhere neat
+ miner.block = miner.ethereum.BlockChain().NewBlock(miner.coinbase, miner.txs)
} else {
/*