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
a82b89e2
Commit
a82b89e2
authored
Nov 03, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added storage root to dump
parent
c8302882
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
3 deletions
+8
-3
database.go
ethdb/database.go
+0
-1
dump.go
state/dump.go
+2
-1
state_object.go
state/state_object.go
+5
-0
trie.go
trie/trie.go
+1
-1
No files found.
ethdb/database.go
View file @
a82b89e2
...
@@ -47,7 +47,6 @@ func (self *LDBDatabase) Get(key []byte) ([]byte, error) {
...
@@ -47,7 +47,6 @@ func (self *LDBDatabase) Get(key []byte) ([]byte, error) {
}
}
if
self
.
comp
{
if
self
.
comp
{
//fmt.Println("get", dat)
return
rle
.
Decompress
(
dat
)
return
rle
.
Decompress
(
dat
)
}
}
...
...
state/dump.go
View file @
a82b89e2
...
@@ -10,6 +10,7 @@ import (
...
@@ -10,6 +10,7 @@ import (
type
Account
struct
{
type
Account
struct
{
Balance
string
`json:"balance"`
Balance
string
`json:"balance"`
Nonce
uint64
`json:"nonce"`
Nonce
uint64
`json:"nonce"`
Root
string
`json:"root"`
CodeHash
string
`json:"codeHash"`
CodeHash
string
`json:"codeHash"`
Storage
map
[
string
]
string
`json:"storage"`
Storage
map
[
string
]
string
`json:"storage"`
}
}
...
@@ -28,7 +29,7 @@ func (self *State) Dump() []byte {
...
@@ -28,7 +29,7 @@ func (self *State) Dump() []byte {
self
.
Trie
.
NewIterator
()
.
Each
(
func
(
key
string
,
value
*
ethutil
.
Value
)
{
self
.
Trie
.
NewIterator
()
.
Each
(
func
(
key
string
,
value
*
ethutil
.
Value
)
{
stateObject
:=
NewStateObjectFromBytes
([]
byte
(
key
),
value
.
Bytes
())
stateObject
:=
NewStateObjectFromBytes
([]
byte
(
key
),
value
.
Bytes
())
account
:=
Account
{
Balance
:
stateObject
.
balance
.
String
(),
Nonce
:
stateObject
.
Nonce
,
CodeHash
:
ethutil
.
Bytes2Hex
(
stateObject
.
codeHash
)}
account
:=
Account
{
Balance
:
stateObject
.
balance
.
String
(),
Nonce
:
stateObject
.
Nonce
,
Root
:
ethutil
.
Bytes2Hex
(
stateObject
.
Root
()),
CodeHash
:
ethutil
.
Bytes2Hex
(
stateObject
.
codeHash
)}
account
.
Storage
=
make
(
map
[
string
]
string
)
account
.
Storage
=
make
(
map
[
string
]
string
)
stateObject
.
EachStorage
(
func
(
key
string
,
value
*
ethutil
.
Value
)
{
stateObject
.
EachStorage
(
func
(
key
string
,
value
*
ethutil
.
Value
)
{
...
...
state/state_object.go
View file @
a82b89e2
...
@@ -283,6 +283,10 @@ func (self *StateObject) Object() *StateObject {
...
@@ -283,6 +283,10 @@ func (self *StateObject) Object() *StateObject {
return
self
return
self
}
}
func
(
self
*
StateObject
)
Root
()
[]
byte
{
return
self
.
State
.
Trie
.
GetRoot
()
}
// Debug stuff
// Debug stuff
func
(
self
*
StateObject
)
CreateOutputForDiff
()
{
func
(
self
*
StateObject
)
CreateOutputForDiff
()
{
fmt
.
Printf
(
"%x %x %x %x
\n
"
,
self
.
Address
(),
self
.
State
.
Root
(),
self
.
balance
.
Bytes
(),
self
.
Nonce
)
fmt
.
Printf
(
"%x %x %x %x
\n
"
,
self
.
Address
(),
self
.
State
.
Root
(),
self
.
balance
.
Bytes
(),
self
.
Nonce
)
...
@@ -297,6 +301,7 @@ func (self *StateObject) CreateOutputForDiff() {
...
@@ -297,6 +301,7 @@ func (self *StateObject) CreateOutputForDiff() {
// State object encoding methods
// State object encoding methods
func
(
c
*
StateObject
)
RlpEncode
()
[]
byte
{
func
(
c
*
StateObject
)
RlpEncode
()
[]
byte
{
fmt
.
Printf
(
"%x %x
\n
"
,
c
.
State
.
Trie
.
Root
,
c
.
CodeHash
())
return
ethutil
.
Encode
([]
interface
{}{
c
.
Nonce
,
c
.
balance
,
c
.
State
.
Trie
.
Root
,
c
.
CodeHash
()})
return
ethutil
.
Encode
([]
interface
{}{
c
.
Nonce
,
c
.
balance
,
c
.
State
.
Trie
.
Root
,
c
.
CodeHash
()})
}
}
...
...
trie/trie.go
View file @
a82b89e2
...
@@ -178,7 +178,7 @@ func (self *Trie) setRoot(root interface{}) {
...
@@ -178,7 +178,7 @@ func (self *Trie) setRoot(root interface{}) {
switch
t
:=
root
.
(
type
)
{
switch
t
:=
root
.
(
type
)
{
case
string
:
case
string
:
if
t
==
""
{
if
t
==
""
{
root
=
crypto
.
Sha3
(
[]
byt
e
(
""
))
root
=
crypto
.
Sha3
(
ethutil
.
Encod
e
(
""
))
}
}
self
.
Root
=
root
self
.
Root
=
root
case
[]
byte
:
case
[]
byte
:
...
...
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