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
50bc8380
Commit
50bc8380
authored
Jul 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved checks
parent
69acda2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
state.go
ethchain/state.go
+0
-1
state_object.go
ethchain/state_object.go
+19
-10
No files found.
ethchain/state.go
View file @
50bc8380
...
@@ -145,7 +145,6 @@ func (self *State) Set(state *State) {
...
@@ -145,7 +145,6 @@ func (self *State) Set(state *State) {
self
.
trie
=
state
.
trie
self
.
trie
=
state
.
trie
self
.
stateObjects
=
state
.
stateObjects
self
.
stateObjects
=
state
.
stateObjects
//*self = *state
}
}
func
(
s
*
State
)
Root
()
interface
{}
{
func
(
s
*
State
)
Root
()
interface
{}
{
...
...
ethchain/state_object.go
View file @
50bc8380
...
@@ -54,6 +54,7 @@ type StateObject struct {
...
@@ -54,6 +54,7 @@ type StateObject struct {
func
(
self
*
StateObject
)
Reset
()
{
func
(
self
*
StateObject
)
Reset
()
{
self
.
storage
=
make
(
Storage
)
self
.
storage
=
make
(
Storage
)
self
.
state
.
Reset
()
}
}
// Converts an transaction in to a state object
// Converts an transaction in to a state object
...
@@ -78,7 +79,7 @@ func NewStateObject(addr []byte) *StateObject {
...
@@ -78,7 +79,7 @@ func NewStateObject(addr []byte) *StateObject {
object
:=
&
StateObject
{
address
:
address
,
Amount
:
new
(
big
.
Int
),
gasPool
:
new
(
big
.
Int
)}
object
:=
&
StateObject
{
address
:
address
,
Amount
:
new
(
big
.
Int
),
gasPool
:
new
(
big
.
Int
)}
object
.
state
=
NewState
(
ethtrie
.
NewTrie
(
ethutil
.
Config
.
Db
,
""
))
object
.
state
=
NewState
(
ethtrie
.
NewTrie
(
ethutil
.
Config
.
Db
,
""
))
object
.
storage
=
make
(
map
[
string
]
*
ethutil
.
Valu
e
)
object
.
storage
=
make
(
Storag
e
)
return
object
return
object
}
}
...
@@ -125,23 +126,24 @@ func (self *StateObject) SetStorage(key *big.Int, value *ethutil.Value) {
...
@@ -125,23 +126,24 @@ func (self *StateObject) SetStorage(key *big.Int, value *ethutil.Value) {
self
.
setStorage
(
key
.
Bytes
(),
value
)
self
.
setStorage
(
key
.
Bytes
(),
value
)
}
}
func
(
self
*
StateObject
)
getStorage
(
k
ey
[]
byte
)
*
ethutil
.
Value
{
func
(
self
*
StateObject
)
getStorage
(
k
[]
byte
)
*
ethutil
.
Value
{
k
:=
ethutil
.
LeftPadBytes
(
key
,
32
)
k
ey
:=
ethutil
.
LeftPadBytes
(
k
,
32
)
value
:=
self
.
storage
[
string
(
k
)]
value
:=
self
.
storage
[
string
(
k
ey
)]
if
value
==
nil
{
if
value
==
nil
{
value
=
self
.
GetAddr
(
k
)
value
=
self
.
GetAddr
(
k
ey
)
self
.
storage
[
string
(
k
)]
=
value
if
!
value
.
IsNil
()
{
self
.
storage
[
string
(
key
)]
=
value
}
}
}
return
value
return
value
}
}
func
(
self
*
StateObject
)
setStorage
(
key
[]
byte
,
value
*
ethutil
.
Value
)
{
func
(
self
*
StateObject
)
setStorage
(
k
[]
byte
,
value
*
ethutil
.
Value
)
{
k
:=
ethutil
.
LeftPadBytes
(
key
,
32
)
key
:=
ethutil
.
LeftPadBytes
(
k
,
32
)
self
.
storage
[
string
(
key
)]
=
value
.
Copy
()
self
.
storage
[
string
(
k
)]
=
value
}
}
func
(
self
*
StateObject
)
Sync
()
{
func
(
self
*
StateObject
)
Sync
()
{
...
@@ -152,9 +154,16 @@ func (self *StateObject) Sync() {
...
@@ -152,9 +154,16 @@ func (self *StateObject) Sync() {
}
}
self
.
SetAddr
([]
byte
(
key
),
value
)
self
.
SetAddr
([]
byte
(
key
),
value
)
}
valid
,
t2
:=
ethtrie
.
ParanoiaCheck
(
self
.
state
.
trie
)
if
!
valid
{
self
.
state
.
trie
=
t2
statelogger
.
Infoln
(
"Warn: PARANOIA: Different state storage root during copy"
)
}
}
}
}
func
(
c
*
StateObject
)
GetInstr
(
pc
*
big
.
Int
)
*
ethutil
.
Value
{
func
(
c
*
StateObject
)
GetInstr
(
pc
*
big
.
Int
)
*
ethutil
.
Value
{
if
int64
(
len
(
c
.
script
)
-
1
)
<
pc
.
Int64
()
{
if
int64
(
len
(
c
.
script
)
-
1
)
<
pc
.
Int64
()
{
return
ethutil
.
NewValue
(
0
)
return
ethutil
.
NewValue
(
0
)
...
...
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