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
fe564613
Commit
fe564613
authored
Jul 19, 2016
by
Péter Szilágyi
Committed by
GitHub
Jul 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2834 from zsfelfoldi/chaindb-upgrade-fix
eth: fixed chaindb upgrade
parents
a4c4125b
56efed71
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
db_upgrade.go
eth/db_upgrade.go
+13
-0
No files found.
eth/db_upgrade.go
View file @
fe564613
...
...
@@ -93,6 +93,9 @@ func upgradeSequentialKeys(db ethdb.Database) (stopFn func()) {
func
upgradeSequentialCanonicalNumbers
(
db
ethdb
.
Database
,
stopFn
func
()
bool
)
(
error
,
bool
)
{
prefix
:=
[]
byte
(
"block-num-"
)
it
:=
db
.
(
*
ethdb
.
LDBDatabase
)
.
NewIterator
()
defer
func
()
{
it
.
Release
()
}()
it
.
Seek
(
prefix
)
cnt
:=
0
for
bytes
.
HasPrefix
(
it
.
Key
(),
prefix
)
{
...
...
@@ -100,6 +103,9 @@ func upgradeSequentialCanonicalNumbers(db ethdb.Database, stopFn func() bool) (e
if
len
(
keyPtr
)
<
20
{
cnt
++
if
cnt
%
100000
==
0
{
it
.
Release
()
it
=
db
.
(
*
ethdb
.
LDBDatabase
)
.
NewIterator
()
it
.
Seek
(
keyPtr
)
glog
.
V
(
logger
.
Info
)
.
Infof
(
"converting %d canonical numbers..."
,
cnt
)
}
number
:=
big
.
NewInt
(
0
)
.
SetBytes
(
keyPtr
[
10
:
])
.
Uint64
()
...
...
@@ -130,6 +136,9 @@ func upgradeSequentialCanonicalNumbers(db ethdb.Database, stopFn func() bool) (e
func
upgradeSequentialBlocks
(
db
ethdb
.
Database
,
stopFn
func
()
bool
)
(
error
,
bool
)
{
prefix
:=
[]
byte
(
"block-"
)
it
:=
db
.
(
*
ethdb
.
LDBDatabase
)
.
NewIterator
()
defer
func
()
{
it
.
Release
()
}()
it
.
Seek
(
prefix
)
cnt
:=
0
for
bytes
.
HasPrefix
(
it
.
Key
(),
prefix
)
{
...
...
@@ -137,6 +146,9 @@ func upgradeSequentialBlocks(db ethdb.Database, stopFn func() bool) (error, bool
if
len
(
keyPtr
)
>=
38
{
cnt
++
if
cnt
%
10000
==
0
{
it
.
Release
()
it
=
db
.
(
*
ethdb
.
LDBDatabase
)
.
NewIterator
()
it
.
Seek
(
keyPtr
)
glog
.
V
(
logger
.
Info
)
.
Infof
(
"converting %d blocks..."
,
cnt
)
}
// convert header, body, td and block receipts
...
...
@@ -175,6 +187,7 @@ func upgradeSequentialBlocks(db ethdb.Database, stopFn func() bool) (error, bool
func
upgradeSequentialOrphanedReceipts
(
db
ethdb
.
Database
,
stopFn
func
()
bool
)
(
error
,
bool
)
{
prefix
:=
[]
byte
(
"receipts-block-"
)
it
:=
db
.
(
*
ethdb
.
LDBDatabase
)
.
NewIterator
()
defer
it
.
Release
()
it
.
Seek
(
prefix
)
cnt
:=
0
for
bytes
.
HasPrefix
(
it
.
Key
(),
prefix
)
{
...
...
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