Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
0e351927
Unverified
Commit
0e351927
authored
Jan 25, 2022
by
Martin Holst Swende
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/rawdb: do prefixed lookup first
parent
f9ce40bb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
accessors_state.go
core/rawdb/accessors_state.go
+5
-7
No files found.
core/rawdb/accessors_state.go
View file @
0e351927
...
@@ -41,16 +41,14 @@ func WritePreimages(db ethdb.KeyValueWriter, preimages map[common.Hash][]byte) {
...
@@ -41,16 +41,14 @@ func WritePreimages(db ethdb.KeyValueWriter, preimages map[common.Hash][]byte) {
// ReadCode retrieves the contract code of the provided code hash.
// ReadCode retrieves the contract code of the provided code hash.
func
ReadCode
(
db
ethdb
.
KeyValueReader
,
hash
common
.
Hash
)
[]
byte
{
func
ReadCode
(
db
ethdb
.
KeyValueReader
,
hash
common
.
Hash
)
[]
byte
{
// Try with the legacy code scheme first, if not then try with current
// Try with the prefixed code scheme first, if not then try with legacy
// scheme. Since most of the code will be found with legacy scheme.
// scheme.
//
data
:=
ReadCodeWithPrefix
(
db
,
hash
)
// todo(rjl493456442) change the order when we forcibly upgrade the code
// scheme with snapshot.
data
,
_
:=
db
.
Get
(
hash
[
:
])
if
len
(
data
)
!=
0
{
if
len
(
data
)
!=
0
{
return
data
return
data
}
}
return
ReadCodeWithPrefix
(
db
,
hash
)
data
,
_
:=
db
.
Get
(
hash
[
:
])
return
data
}
}
// ReadCodeWithPrefix retrieves the contract code of the provided code hash.
// ReadCodeWithPrefix retrieves the contract code of the provided code hash.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment