Additional logging and removed temp merged mining options.

pull/206/head
obscuren 10 years ago
parent 99481a245a
commit 5ebae82eeb
  1. 6
      chain/block_manager.go
  2. 2
      chain/chain_manager.go
  3. 4
      chain/error.go
  4. 2
      cmd/mist/assets/qml/views/miner.qml

@ -185,8 +185,7 @@ func (sm *BlockManager) Process(block *Block) (td *big.Int, msgs state.Messages,
defer sm.mutex.Unlock()
if sm.bc.HasBlock(block.Hash()) {
fmt.Println("already having this block")
return nil, nil, nil
return nil, nil, &KnownBlockError{block.Number, block.Hash()}
}
if !sm.bc.HasBlock(block.PrevHash) {
@ -233,12 +232,10 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, me
// Block validation
if err = sm.ValidateBlock(block, parent); err != nil {
statelogger.Errorln("validating block:", err)
return
}
if err = sm.AccumelateRewards(state, block, parent); err != nil {
statelogger.Errorln("accumulating reward", err)
return
}
@ -271,7 +268,6 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, me
sm.transState = state.Copy()
sm.eth.TxPool().RemoveSet(block.Transactions())
fmt.Println("TD", td)
return td, messages, nil
} else {

@ -330,10 +330,10 @@ func (self *ChainManager) InsertChain(chain Blocks) error {
continue
}
chainlogger.Infof("block process failed %v (%x)\n", block.Number, block.Hash()[:4])
return err
}
fmt.Println(td, messages, err)
self.add(block)
self.SetTotalDifficulty(td)
self.Ethereum.EventMux().Post(NewBlockEvent{block})

@ -128,12 +128,12 @@ func IsTDError(e error) bool {
}
type KnownBlockError struct {
number uint64
number *big.Int
hash []byte
}
func (self *KnownBlockError) Error() string {
return fmt.Sprintf("block %d already known (%x)", self.number, self.hash[0:4])
return fmt.Sprintf("block %v already known (%x)", self.number, self.hash[0:4])
}
func IsKnownBlockErr(e error) bool {
_, ok := e.(*KnownBlockError)

@ -119,12 +119,14 @@ Rectangle {
}
}
Component.onCompleted: {
/*
// XXX Temp. replace with above eventually
var tmpItems = ["JEVCoin", "Some coin", "Other coin", "Etc coin"];
var address = "e6716f9544a56c530d868e4bfbacb172315bdead";
for (var i = 0; i < tmpItems.length; i++) {
mergedMiningModel.append({checked: false, name: tmpItems[i], address: address, id: 0, itemId: i});
}
*/
}
}
}

Loading…
Cancel
Save