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
6fcc6a2f
Commit
6fcc6a2f
authored
Jun 19, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed copy/set
parent
0b8ba1d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
state_object.go
ethchain/state_object.go
+22
-1
No files found.
ethchain/state_object.go
View file @
6fcc6a2f
...
@@ -48,7 +48,7 @@ func MakeContract(tx *Transaction, state *State) *StateObject {
...
@@ -48,7 +48,7 @@ func MakeContract(tx *Transaction, state *State) *StateObject {
}
}
func
NewStateObject
(
addr
[]
byte
)
*
StateObject
{
func
NewStateObject
(
addr
[]
byte
)
*
StateObject
{
return
&
StateObject
{
address
:
addr
,
Amount
:
new
(
big
.
Int
)}
return
&
StateObject
{
address
:
addr
,
Amount
:
new
(
big
.
Int
)
,
gasPool
:
new
(
big
.
Int
)
}
}
}
func
NewContract
(
address
[]
byte
,
Amount
*
big
.
Int
,
root
[]
byte
)
*
StateObject
{
func
NewContract
(
address
[]
byte
,
Amount
*
big
.
Int
,
root
[]
byte
)
*
StateObject
{
...
@@ -176,6 +176,26 @@ func (self *StateObject) RefundGas(gas, price *big.Int) {
...
@@ -176,6 +176,26 @@ func (self *StateObject) RefundGas(gas, price *big.Int) {
self
.
Amount
.
Sub
(
self
.
Amount
,
rGas
)
self
.
Amount
.
Sub
(
self
.
Amount
,
rGas
)
}
}
func
(
self
*
StateObject
)
Copy
()
*
StateObject
{
stateObject
:=
NewStateObject
(
self
.
Address
())
stateObject
.
Amount
.
Set
(
self
.
Amount
)
stateObject
.
ScriptHash
=
ethutil
.
CopyBytes
(
self
.
ScriptHash
)
stateObject
.
Nonce
=
self
.
Nonce
if
self
.
state
!=
nil
{
stateObject
.
state
=
self
.
state
.
Copy
()
}
stateObject
.
script
=
ethutil
.
CopyBytes
(
self
.
script
)
stateObject
.
initScript
=
ethutil
.
CopyBytes
(
self
.
initScript
)
//stateObject.gasPool.Set(self.gasPool)
return
self
}
func
(
self
*
StateObject
)
Set
(
stateObject
*
StateObject
)
{
self
=
stateObject
}
/*
func (self *StateObject) Copy() *StateObject {
func (self *StateObject) Copy() *StateObject {
stCopy := &StateObject{}
stCopy := &StateObject{}
stCopy.address = make([]byte, len(self.address))
stCopy.address = make([]byte, len(self.address))
...
@@ -194,6 +214,7 @@ func (self *StateObject) Copy() *StateObject {
...
@@ -194,6 +214,7 @@ func (self *StateObject) Copy() *StateObject {
return stCopy
return stCopy
}
}
*/
// Returns the address of the contract/account
// Returns the address of the contract/account
func
(
c
*
StateObject
)
Address
()
[]
byte
{
func
(
c
*
StateObject
)
Address
()
[]
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