blob: 7f776bcfb143fdf4cf37afe13ebcdc3a9e326d48 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package light
import (
"github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/consensus"
"github.com/dexon-foundation/dexon/log"
)
type HeaderValidator struct {
chain *LightChain
}
func (v *HeaderValidator) ValidateWitnessData(height uint64, blockHash common.Hash) error {
b := v.chain.GetHeaderByNumber(height)
if b == nil {
log.Error("can not find block %v either pending or confirmed block", height)
return consensus.ErrWitnessMismatch
}
if b.Hash() != blockHash {
log.Error("invalid witness block %s vs %s",
b.Hash().String(), blockHash.String())
return consensus.ErrWitnessMismatch
}
return nil
}
|