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
1e965cb8
Commit
1e965cb8
authored
Jun 25, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved BlockDo to utils
parent
fd1ddbce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
javascript_runtime.go
ethereum/javascript_runtime.go
+1
-1
cmd.go
utils/cmd.go
+19
-0
No files found.
ethereum/javascript_runtime.go
View file @
1e965cb8
...
...
@@ -215,7 +215,7 @@ func (self *JSRE) execBlock(call otto.FunctionCall) otto.Value {
return
otto
.
UndefinedValue
()
}
err
=
self
.
ethereum
.
BlockDo
(
ethutil
.
FromHex
(
hash
))
err
=
utils
.
BlockDo
(
self
.
ethereum
,
ethutil
.
FromHex
(
hash
))
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
otto
.
FalseValue
()
...
...
utils/cmd.go
View file @
1e965cb8
package
utils
import
(
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethminer"
"github.com/ethereum/eth-go/ethpub"
...
...
@@ -74,3 +75,21 @@ func StartMining(ethereum *eth.Ethereum) bool {
return
false
}
// Replay block
func
BlockDo
(
ethereum
*
eth
.
Ethereum
,
hash
[]
byte
)
error
{
block
:=
ethereum
.
BlockChain
()
.
GetBlock
(
hash
)
if
block
==
nil
{
return
fmt
.
Errorf
(
"unknown block %x"
,
hash
)
}
parent
:=
ethereum
.
BlockChain
()
.
GetBlock
(
block
.
PrevHash
)
_
,
err
:=
ethereum
.
StateManager
()
.
ApplyDiff
(
parent
.
State
(),
parent
,
block
)
if
err
!=
nil
{
return
err
}
return
nil
}
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