mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Added hash checking to dbStore.Get
This commit is contained in:
parent
4e32d8c392
commit
80d398ce6d
1 changed files with 9 additions and 0 deletions
|
|
@ -324,6 +324,15 @@ func (s *dbStore) Get(key Key) (chunk *Chunk, err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
hasher := hasherfunc.New()
|
||||
hasher.Write(data)
|
||||
if bytes.Compare(hasher.Sum(nil), key) != 0 {
|
||||
s.db.Delete(getDataKey(index.Idx))
|
||||
err = notFound
|
||||
return
|
||||
}
|
||||
|
||||
chunk = &Chunk{
|
||||
Key: key,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue