check preimages first

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-06-12 22:56:11 +08:00
parent 1ebe82d779
commit b6763c9864

View file

@ -240,12 +240,12 @@ func (t *StateTrie) DeleteAccount(address common.Address) error {
// GetKey returns the sha3 preimage of a hashed key that was // GetKey returns the sha3 preimage of a hashed key that was
// previously used to store a value. // previously used to store a value.
func (t *StateTrie) GetKey(shaKey []byte) []byte { func (t *StateTrie) GetKey(shaKey []byte) []byte {
if key, ok := t.getSecKeyCache()[common.BytesToHash(shaKey)]; ok {
return key
}
if t.preimages == nil { if t.preimages == nil {
return nil return nil
} }
if key, ok := t.getSecKeyCache()[common.BytesToHash(shaKey)]; ok {
return key
}
return t.preimages.Preimage(common.BytesToHash(shaKey)) return t.preimages.Preimage(common.BytesToHash(shaKey))
} }