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
5a0c4ce2
Commit
5a0c4ce2
authored
Jul 13, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed "Copy" to also copy over the pending storage changes
parent
04f8c455
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
state_object.go
ethchain/state_object.go
+18
-5
No files found.
ethchain/state_object.go
View file @
5a0c4ce2
...
...
@@ -15,6 +15,18 @@ func (self Code) String() string {
return
strings
.
Join
(
Disassemble
(
self
),
" "
)
}
type
Storage
map
[
string
]
*
ethutil
.
Value
func
(
self
Storage
)
Copy
()
Storage
{
cpy
:=
make
(
Storage
)
for
key
,
value
:=
range
self
{
// XXX Do we need a 'value' copy or is this sufficient?
cpy
[
key
]
=
value
}
return
cpy
}
type
StateObject
struct
{
// Address of the object
address
[]
byte
...
...
@@ -27,7 +39,7 @@ type StateObject struct {
script
Code
initScript
Code
storage
map
[
string
]
*
ethutil
.
Valu
e
storage
Storag
e
// Total gas pool is the total amount of gas currently
// left if this object is the coinbase. Gas is directly
...
...
@@ -41,7 +53,7 @@ type StateObject struct {
}
func
(
self
*
StateObject
)
Reset
()
{
self
.
storage
=
make
(
map
[
string
]
*
ethutil
.
Valu
e
)
self
.
storage
=
make
(
Storag
e
)
}
// Converts an transaction in to a state object
...
...
@@ -95,7 +107,7 @@ func NewStateObjectFromBytes(address, data []byte) *StateObject {
func
(
self
*
StateObject
)
MarkForDeletion
()
{
self
.
remove
=
true
statelogger
.
Info
f
(
"%x: #%d %v (deletion)
\n
"
,
self
.
Address
(),
self
.
Nonce
,
self
.
Amount
)
statelogger
.
DebugDetail
f
(
"%x: #%d %v (deletion)
\n
"
,
self
.
Address
(),
self
.
Nonce
,
self
.
Amount
)
}
func
(
c
*
StateObject
)
GetAddr
(
addr
[]
byte
)
*
ethutil
.
Value
{
...
...
@@ -154,13 +166,13 @@ func (c *StateObject) GetInstr(pc *big.Int) *ethutil.Value {
func
(
c
*
StateObject
)
AddAmount
(
amount
*
big
.
Int
)
{
c
.
SetAmount
(
new
(
big
.
Int
)
.
Add
(
c
.
Amount
,
amount
))
statelogger
.
Info
f
(
"%x: #%d %v (+ %v)
\n
"
,
c
.
Address
(),
c
.
Nonce
,
c
.
Amount
,
amount
)
statelogger
.
DebugDetail
f
(
"%x: #%d %v (+ %v)
\n
"
,
c
.
Address
(),
c
.
Nonce
,
c
.
Amount
,
amount
)
}
func
(
c
*
StateObject
)
SubAmount
(
amount
*
big
.
Int
)
{
c
.
SetAmount
(
new
(
big
.
Int
)
.
Sub
(
c
.
Amount
,
amount
))
statelogger
.
Info
f
(
"%x: #%d %v (- %v)
\n
"
,
c
.
Address
(),
c
.
Nonce
,
c
.
Amount
,
amount
)
statelogger
.
DebugDetail
f
(
"%x: #%d %v (- %v)
\n
"
,
c
.
Address
(),
c
.
Nonce
,
c
.
Amount
,
amount
)
}
func
(
c
*
StateObject
)
SetAmount
(
amount
*
big
.
Int
)
{
...
...
@@ -222,6 +234,7 @@ func (self *StateObject) Copy() *StateObject {
}
stateObject
.
script
=
ethutil
.
CopyBytes
(
self
.
script
)
stateObject
.
initScript
=
ethutil
.
CopyBytes
(
self
.
initScript
)
stateObject
.
storage
=
self
.
storage
.
Copy
()
return
stateObject
}
...
...
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