From b6763c98649b86124814d2bc39a3e0c0ed1f7fe7 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 12 Jun 2025 22:56:11 +0800 Subject: [PATCH] check preimages first Signed-off-by: jsvisa --- trie/secure_trie.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trie/secure_trie.go b/trie/secure_trie.go index 9d391d8ec6..ac20f961e5 100644 --- a/trie/secure_trie.go +++ b/trie/secure_trie.go @@ -240,12 +240,12 @@ func (t *StateTrie) DeleteAccount(address common.Address) error { // GetKey returns the sha3 preimage of a hashed key that was // previously used to store a value. func (t *StateTrie) GetKey(shaKey []byte) []byte { - if key, ok := t.getSecKeyCache()[common.BytesToHash(shaKey)]; ok { - return key - } if t.preimages == nil { return nil } + if key, ok := t.getSecKeyCache()[common.BytesToHash(shaKey)]; ok { + return key + } return t.preimages.Preimage(common.BytesToHash(shaKey)) }