forked from cerc-io/plugeth
Additional logging and removed temp merged mining options.
This commit is contained in:
parent
99481a245a
commit
5ebae82eeb
@ -185,8 +185,7 @@ func (sm *BlockManager) Process(block *Block) (td *big.Int, msgs state.Messages,
|
|||||||
defer sm.mutex.Unlock()
|
defer sm.mutex.Unlock()
|
||||||
|
|
||||||
if sm.bc.HasBlock(block.Hash()) {
|
if sm.bc.HasBlock(block.Hash()) {
|
||||||
fmt.Println("already having this block")
|
return nil, nil, &KnownBlockError{block.Number, block.Hash()}
|
||||||
return nil, nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !sm.bc.HasBlock(block.PrevHash) {
|
if !sm.bc.HasBlock(block.PrevHash) {
|
||||||
@ -233,12 +232,10 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, me
|
|||||||
|
|
||||||
// Block validation
|
// Block validation
|
||||||
if err = sm.ValidateBlock(block, parent); err != nil {
|
if err = sm.ValidateBlock(block, parent); err != nil {
|
||||||
statelogger.Errorln("validating block:", err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = sm.AccumelateRewards(state, block, parent); err != nil {
|
if err = sm.AccumelateRewards(state, block, parent); err != nil {
|
||||||
statelogger.Errorln("accumulating reward", err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +268,6 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, me
|
|||||||
sm.transState = state.Copy()
|
sm.transState = state.Copy()
|
||||||
|
|
||||||
sm.eth.TxPool().RemoveSet(block.Transactions())
|
sm.eth.TxPool().RemoveSet(block.Transactions())
|
||||||
fmt.Println("TD", td)
|
|
||||||
|
|
||||||
return td, messages, nil
|
return td, messages, nil
|
||||||
} else {
|
} else {
|
||||||
|
@ -330,10 +330,10 @@ func (self *ChainManager) InsertChain(chain Blocks) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chainlogger.Infof("block process failed %v (%x)\n", block.Number, block.Hash()[:4])
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(td, messages, err)
|
|
||||||
self.add(block)
|
self.add(block)
|
||||||
self.SetTotalDifficulty(td)
|
self.SetTotalDifficulty(td)
|
||||||
self.Ethereum.EventMux().Post(NewBlockEvent{block})
|
self.Ethereum.EventMux().Post(NewBlockEvent{block})
|
||||||
|
@ -128,12 +128,12 @@ func IsTDError(e error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type KnownBlockError struct {
|
type KnownBlockError struct {
|
||||||
number uint64
|
number *big.Int
|
||||||
hash []byte
|
hash []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *KnownBlockError) Error() string {
|
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 {
|
func IsKnownBlockErr(e error) bool {
|
||||||
_, ok := e.(*KnownBlockError)
|
_, ok := e.(*KnownBlockError)
|
||||||
|
@ -119,12 +119,14 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
/*
|
||||||
// XXX Temp. replace with above eventually
|
// XXX Temp. replace with above eventually
|
||||||
var tmpItems = ["JEVCoin", "Some coin", "Other coin", "Etc coin"];
|
var tmpItems = ["JEVCoin", "Some coin", "Other coin", "Etc coin"];
|
||||||
var address = "e6716f9544a56c530d868e4bfbacb172315bdead";
|
var address = "e6716f9544a56c530d868e4bfbacb172315bdead";
|
||||||
for (var i = 0; i < tmpItems.length; i++) {
|
for (var i = 0; i < tmpItems.length; i++) {
|
||||||
mergedMiningModel.append({checked: false, name: tmpItems[i], address: address, id: 0, itemId: i});
|
mergedMiningModel.append({checked: false, name: tmpItems[i], address: address, id: 0, itemId: i});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user