Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
6bd4296a
Commit
6bd4296a
authored
Sep 21, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nonces work
parent
78e78b68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
state_object.go
minigeth/core/state/state_object.go
+8
-0
statedb.go
minigeth/core/state/statedb.go
+13
-0
No files found.
minigeth/core/state/state_object.go
View file @
6bd4296a
...
@@ -121,3 +121,11 @@ func newObject(db *StateDB, address common.Address, data Account) *stateObject {
...
@@ -121,3 +121,11 @@ func newObject(db *StateDB, address common.Address, data Account) *stateObject {
func
(
s
*
stateObject
)
setBalance
(
amount
*
big
.
Int
)
{
func
(
s
*
stateObject
)
setBalance
(
amount
*
big
.
Int
)
{
s
.
data
.
Balance
=
amount
s
.
data
.
Balance
=
amount
}
}
func
(
s
*
stateObject
)
SetNonce
(
nonce
uint64
)
{
s
.
setNonce
(
nonce
)
}
func
(
s
*
stateObject
)
setNonce
(
nonce
uint64
)
{
s
.
data
.
Nonce
=
nonce
}
minigeth/core/state/statedb.go
View file @
6bd4296a
...
@@ -199,6 +199,10 @@ func (s *StateDB) SetCode(addr common.Address, code []byte) {
...
@@ -199,6 +199,10 @@ func (s *StateDB) SetCode(addr common.Address, code []byte) {
func
(
s
*
StateDB
)
SetNonce
(
addr
common
.
Address
,
nonce
uint64
)
{
func
(
s
*
StateDB
)
SetNonce
(
addr
common
.
Address
,
nonce
uint64
)
{
fmt
.
Println
(
"SetNonce"
,
addr
,
nonce
)
fmt
.
Println
(
"SetNonce"
,
addr
,
nonce
)
stateObject
:=
s
.
GetOrNewStateObject
(
addr
)
if
stateObject
!=
nil
{
stateObject
.
SetNonce
(
nonce
)
}
}
}
func
(
s
*
StateDB
)
SetState
(
addr
common
.
Address
,
key
,
value
common
.
Hash
)
{
func
(
s
*
StateDB
)
SetState
(
addr
common
.
Address
,
key
,
value
common
.
Hash
)
{
...
@@ -281,3 +285,12 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
...
@@ -281,3 +285,12 @@ func (s *StateDB) createObject(addr common.Address) (newobj, prev *stateObject)
}
}
return
newobj
,
nil
return
newobj
,
nil
}
}
// GetOrNewStateObject retrieves a state object or create a new state object if nil.
func
(
s
*
StateDB
)
GetOrNewStateObject
(
addr
common
.
Address
)
*
stateObject
{
stateObject
:=
s
.
getStateObject
(
addr
)
if
stateObject
==
nil
{
stateObject
,
_
=
s
.
createObject
(
addr
)
}
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