[core] fix cache introduced by getHashByNumber (#3814)

pull/3816/head v4.1.10
Jacky Wang 3 years ago committed by GitHub
parent ab5be8f413
commit 7b0f6ac8d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      core/headerchain.go

@ -454,7 +454,9 @@ func (hc *HeaderChain) getHashByNumber(number uint64) common.Hash {
return hash.(common.Hash)
}
hash := rawdb.ReadCanonicalHash(hc.chainDb, number)
hc.canonicalCache.Add(number, hash)
if hash != (common.Hash{}) {
hc.canonicalCache.Add(number, hash)
}
return hash
}

Loading…
Cancel
Save