aboutsummaryrefslogtreecommitdiffstats
path: root/core/block_validator.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/block_validator.go')
-rw-r--r--core/block_validator.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/block_validator.go b/core/block_validator.go
index f42ea6b11..856eec27b 100644
--- a/core/block_validator.go
+++ b/core/block_validator.go
@@ -23,6 +23,7 @@ import (
"github.com/dexon-foundation/dexon/consensus"
"github.com/dexon-foundation/dexon/core/state"
"github.com/dexon-foundation/dexon/core/types"
+ "github.com/dexon-foundation/dexon/log"
"github.com/dexon-foundation/dexon/params"
)
@@ -103,14 +104,16 @@ func (v *BlockValidator) ValidateState(block, parent *types.Block, statedb *stat
}
func (v *BlockValidator) ValidateWitnessData(height uint64, blockHash common.Hash) error {
- b := v.bc.GetBlockByNumber(height)
+ b := v.bc.GetHeaderByNumber(height)
if b == nil {
- return fmt.Errorf("can not find block %v either pending or confirmed block", height)
+ log.Error("can not find block %v either pending or confirmed block", height)
+ return consensus.ErrWitnessMismatch
}
if b.Hash() != blockHash {
- return fmt.Errorf("invalid witness block %s vs %s",
+ log.Error("invalid witness block %s vs %s",
b.Hash().String(), blockHash.String())
+ return consensus.ErrWitnessMismatch
}
return nil
}