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
665bb43a
Commit
665bb43a
authored
Nov 28, 2016
by
Felföldi Zsolt
Committed by
Felix Lange
Nov 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
light: implemented VMState.Empty() (#3357)
parent
e4bf0045
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
state_object.go
light/state_object.go
+7
-2
vm_env.go
light/vm_env.go
+7
-0
No files found.
light/state_object.go
View file @
665bb43a
...
...
@@ -201,14 +201,19 @@ func (self *StateObject) Copy() *StateObject {
// Attribute accessors
//
// empty returns whether the account is considered empty.
func
(
self
*
StateObject
)
empty
()
bool
{
return
self
.
nonce
==
0
&&
self
.
balance
.
BitLen
()
==
0
&&
bytes
.
Equal
(
self
.
codeHash
,
emptyCodeHash
)
}
// Balance returns the account balance
func
(
self
*
StateObject
)
Balance
()
*
big
.
Int
{
return
self
.
balance
}
// Address returns the address of the contract/account
func
(
c
*
StateObject
)
Address
()
common
.
Address
{
return
c
.
address
func
(
self
*
StateObject
)
Address
()
common
.
Address
{
return
self
.
address
}
// Code returns the contract code
...
...
light/vm_env.go
View file @
665bb43a
...
...
@@ -263,6 +263,13 @@ func (s *VMState) Exist(addr common.Address) bool {
return
res
}
// Empty returns true if the account at the given address is considered empty
func
(
s
*
VMState
)
Empty
(
addr
common
.
Address
)
bool
{
so
,
err
:=
s
.
state
.
GetStateObject
(
s
.
ctx
,
addr
)
s
.
errHandler
(
err
)
return
so
==
nil
||
so
.
empty
()
}
// HasSuicided returns true if the given account has been marked for deletion
// or false if the account does not exist
func
(
s
*
VMState
)
HasSuicided
(
addr
common
.
Address
)
bool
{
...
...
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