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
5b8dde96
Commit
5b8dde96
authored
Jul 03, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed CREATE op. Fixes #87
parent
81bc721c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
vm.go
ethchain/vm.go
+6
-7
No files found.
ethchain/vm.go
View file @
5b8dde96
...
...
@@ -35,7 +35,6 @@ func CalculateTxGas(initSize *big.Int) *big.Int {
}
type
Vm
struct
{
txPool
*
TxPool
// Stack for processing contracts
stack
*
Stack
// non-persistent key/value memory storage
...
...
@@ -628,11 +627,11 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
)
// Generate a new address
addr
:=
ethcrypto
.
CreateAddress
(
closure
.
caller
.
Address
(),
closure
.
caller
.
N
())
for
i
:=
int64
(
0
);
vm
.
state
.
GetStateObject
(
addr
)
!=
nil
;
i
++
{
t
:=
new
(
big
.
Int
)
.
Set
(
closure
.
caller
.
N
())
addr
=
ethcrypto
.
CreateAddress
(
closure
.
caller
.
Address
(),
t
.
Add
(
t
,
big
.
NewInt
(
i
)))
addr
:=
ethcrypto
.
CreateAddress
(
closure
.
object
.
Address
(),
closure
.
object
.
Nonce
)
for
i
:=
uint64
(
0
);
vm
.
state
.
GetStateObject
(
addr
)
!=
nil
;
i
++
{
ethcrypto
.
CreateAddress
(
closure
.
object
.
Address
(),
closure
.
object
.
Nonce
+
i
)
}
closure
.
object
.
Nonce
++
vm
.
Printf
(
" (*) %x"
,
addr
)
.
Endl
()
...
...
@@ -643,7 +642,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
contract
.
AddAmount
(
value
)
// Set the init script
contract
.
initScript
=
ethutil
.
BigD
(
mem
.
Get
(
offset
.
Int64
(),
size
.
Int64
()))
.
Bytes
(
)
contract
.
initScript
=
mem
.
Get
(
offset
.
Int64
(),
size
.
Int64
()
)
// Transfer all remaining gas to the new
// contract so it may run the init script
gas
:=
new
(
big
.
Int
)
.
Set
(
closure
.
Gas
)
...
...
@@ -653,7 +652,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
c
:=
NewClosure
(
closure
,
contract
,
contract
.
initScript
,
vm
.
state
,
gas
,
closure
.
Price
)
// Call the closure and set the return value as
// main script.
c
.
S
cript
,
err
,
_
=
Call
(
vm
,
c
,
nil
)
c
ontract
.
s
cript
,
err
,
_
=
Call
(
vm
,
c
,
nil
)
}
else
{
err
=
fmt
.
Errorf
(
"Insufficient funds to transfer value. Req %v, has %v"
,
value
,
closure
.
object
.
Amount
)
}
...
...
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