initial testcode for canonical chain

This commit is contained in:
Maran
2014-03-24 15:04:29 +01:00
parent ec6ec62dd4
commit 6253d10938
5 changed files with 119 additions and 14 deletions

View File

@ -144,6 +144,7 @@ func (sm *StateManager) ProcessBlock(block *Block, dontReact bool) error {
hash := block.Hash()
if sm.bc.HasBlock(hash) {
fmt.Println("[SM] We already have this block, ignoring")
return nil
}
@ -158,12 +159,14 @@ func (sm *StateManager) ProcessBlock(block *Block, dontReact bool) error {
// Block validation
if err := sm.ValidateBlock(block); err != nil {
fmt.Println("[SM] Error validating block:", err)
return err
}
// I'm not sure, but I don't know if there should be thrown
// any errors at this time.
if err := sm.AccumelateRewards(block); err != nil {
fmt.Println("[SM] Error accumulating reward", err)
return err
}