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
3590591e
Commit
3590591e
authored
May 26, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1113 from obscuren/develop
core: block database version update
parents
612f0140
222249e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
admin.go
cmd/geth/admin.go
+24
-1
main.go
cmd/geth/main.go
+6
-6
block_processor.go
core/block_processor.go
+4
-1
No files found.
cmd/geth/admin.go
View file @
3590591e
...
...
@@ -88,6 +88,7 @@ func (js *jsre) adminBindings() {
debug
.
Set
(
"getBlockRlp"
,
js
.
getBlockRlp
)
debug
.
Set
(
"setHead"
,
js
.
setHead
)
debug
.
Set
(
"processBlock"
,
js
.
debugBlock
)
debug
.
Set
(
"seedhash"
,
js
.
seedHash
)
// undocumented temporary
debug
.
Set
(
"waitForBlocks"
,
js
.
waitForBlocks
)
}
...
...
@@ -118,6 +119,27 @@ func (js *jsre) getBlock(call otto.FunctionCall) (*types.Block, error) {
return
block
,
nil
}
func
(
js
*
jsre
)
seedHash
(
call
otto
.
FunctionCall
)
otto
.
Value
{
if
len
(
call
.
ArgumentList
)
>
0
{
if
call
.
Argument
(
0
)
.
IsNumber
()
{
num
,
_
:=
call
.
Argument
(
0
)
.
ToInteger
()
hash
,
err
:=
ethash
.
GetSeedHash
(
uint64
(
num
))
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
otto
.
UndefinedValue
()
}
v
,
_
:=
call
.
Otto
.
ToValue
(
fmt
.
Sprintf
(
"0x%x"
,
hash
))
return
v
}
else
{
fmt
.
Println
(
"arg not a number"
)
}
}
else
{
fmt
.
Println
(
"requires number argument"
)
}
return
otto
.
UndefinedValue
()
}
func
(
js
*
jsre
)
pendingTransactions
(
call
otto
.
FunctionCall
)
otto
.
Value
{
txs
:=
js
.
ethereum
.
TxPool
()
.
GetTransactions
()
...
...
@@ -220,10 +242,11 @@ func (js *jsre) debugBlock(call otto.FunctionCall) otto.Value {
vm
.
Debug
=
true
_
,
err
=
js
.
ethereum
.
BlockProcessor
()
.
RetryProcess
(
block
)
if
err
!=
nil
{
glog
.
Info
ln
(
err
)
fmt
.
Print
ln
(
err
)
}
vm
.
Debug
=
old
fmt
.
Println
(
"ok"
)
return
otto
.
UndefinedValue
()
}
...
...
cmd/geth/main.go
View file @
3590591e
...
...
@@ -533,9 +533,9 @@ func importchain(ctx *cli.Context) {
}
// force database flush
ethereum
.
BlockDb
()
.
Close
()
ethereum
.
StateDb
()
.
Close
()
ethereum
.
ExtraDb
()
.
Close
()
ethereum
.
BlockDb
()
.
Flush
()
ethereum
.
StateDb
()
.
Flush
()
ethereum
.
ExtraDb
()
.
Flush
()
fmt
.
Printf
(
"Import done in %v"
,
time
.
Since
(
start
))
...
...
@@ -630,9 +630,9 @@ func upgradeDb(ctx *cli.Context) {
}
// force database flush
ethereum
.
BlockDb
()
.
Close
()
ethereum
.
StateDb
()
.
Close
()
ethereum
.
ExtraDb
()
.
Close
()
ethereum
.
BlockDb
()
.
Flush
()
ethereum
.
StateDb
()
.
Flush
()
ethereum
.
ExtraDb
()
.
Flush
()
os
.
Remove
(
exportFile
)
...
...
core/block_processor.go
View file @
3590591e
...
...
@@ -21,7 +21,7 @@ import (
const
(
// must be bumped when consensus algorithm is changed, this forces the upgradedb
// command to be run (forces the blocks to be imported again using the new algorithm)
BlockChainVersion
=
2
BlockChainVersion
=
3
)
var
receiptsPre
=
[]
byte
(
"receipts-"
)
...
...
@@ -159,6 +159,9 @@ func (sm *BlockProcessor) RetryProcess(block *types.Block) (logs state.Logs, err
return
nil
,
ParentError
(
header
.
ParentHash
)
}
parent
:=
sm
.
bc
.
GetBlock
(
header
.
ParentHash
)
if
!
sm
.
Pow
.
Verify
(
block
)
{
return
nil
,
ValidationError
(
"Block's nonce is invalid (= %x)"
,
block
.
Nonce
)
}
return
sm
.
processWithParent
(
block
,
parent
)
}
...
...
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