Skip to content

Commit 3146b24

Browse files
committed
core, trie: use db.has over db.get where possible ethereum#24117
1 parent 3fecfca commit 3146b24

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

trie/sync.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ func (s *Sync) AddSubTrie(root common.Hash, path []byte, parent common.Hash, cal
156156
}
157157
// If database says this is a duplicate, then at least the trie node is
158158
// present, and we hold the assumption that it's NOT legacy contract code.
159-
blob := rawdb.ReadTrieNode(s.database, root)
160-
if len(blob) > 0 {
159+
if rawdb.HasTrieNode(s.database, root) {
161160
return
162161
}
163162
// Assemble the new sub-trie sync request
@@ -194,7 +193,7 @@ func (s *Sync) AddCodeEntry(hash common.Hash, path []byte, parent common.Hash) {
194193
// sync is expected to run with a fresh new node. Even there
195194
// exists the code with legacy format, fetch and store with
196195
// new scheme anyway.
197-
if blob := rawdb.ReadCodeWithPrefix(s.database, hash); len(blob) > 0 {
196+
if rawdb.HasCodeWithPrefix(s.database, hash) {
198197
return
199198
}
200199
// Assemble the new sub-trie sync request
@@ -402,7 +401,7 @@ func (s *Sync) children(req *request, object node) ([]*request, error) {
402401
}
403402
// If database says duplicate, then at least the trie node is present
404403
// and we hold the assumption that it's NOT legacy contract code.
405-
if blob := rawdb.ReadTrieNode(s.database, hash); len(blob) > 0 {
404+
if rawdb.HasTrieNode(s.database, hash) {
406405
continue
407406
}
408407
// Locally unknown Node, schedule for retrieval

0 commit comments

Comments
 (0)