Additional logging and removed temp merged mining options.

This commit is contained in:
obscuren 2014-12-02 12:23:27 +01:00
parent 99481a245a
commit 5ebae82eeb
4 changed files with 6 additions and 8 deletions

View File

@ -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 {

View File

@ -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})

View File

@ -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)

View File

@ -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});
}
*/
}
}
}