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
17674fb8
Commit
17674fb8
authored
May 01, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added suicide back in
parent
91aa189e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
26 deletions
+18
-26
vm.go
ethchain/vm.go
+18
-26
No files found.
ethchain/vm.go
View file @
17674fb8
...
...
@@ -73,10 +73,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
}
}()
// If the amount of gas supplied is less equal to 0
if
closure
.
Gas
.
Cmp
(
big
.
NewInt
(
0
))
<=
0
{
// TODO Do something
}
ethutil
.
Config
.
Log
.
Debugf
(
"[VM] Running closure %x
\n
"
,
closure
.
object
.
Address
())
// Memory for the current closure
mem
:=
&
Memory
{}
...
...
@@ -107,9 +104,11 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
val
:=
closure
.
Get
(
pc
)
// Get the opcode (it must be an opcode!)
op
:=
OpCode
(
val
.
Uint
())
if
ethutil
.
Config
.
Debug
{
ethutil
.
Config
.
Log
.
Debugf
(
"%-3d %-4s"
,
pc
,
op
.
String
())
}
/*
if ethutil.Config.Debug {
ethutil.Config.Log.Debugf("%-3d %-4s", pc, op.String())
}
*/
gas
:=
new
(
big
.
Int
)
useGas
:=
func
(
amount
*
big
.
Int
)
{
...
...
@@ -163,9 +162,6 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case
oLOG
:
stack
.
Print
()
mem
.
Print
()
case
oSTOP
:
// Stop the closure
return
closure
.
Return
(
nil
),
nil
// 0x20 range
case
oADD
:
require
(
2
)
...
...
@@ -520,22 +516,18 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
return
closure
.
Return
(
ret
),
nil
case
oSUICIDE
:
/*
recAddr := stack.Pop().Bytes()
// Purge all memory
deletedMemory := contract.state.Purge()
// Add refunds to the pop'ed address
refund := new(big.Int).Mul(StoreFee, big.NewInt(int64(deletedMemory)))
account := state.GetAccount(recAddr)
account.Amount.Add(account.Amount, refund)
// Update the refunding address
state.UpdateAccount(recAddr, account)
// Delete the contract
state.trie.Update(string(addr), "")
ethutil.Config.Log.Debugf("(%d) => %x\n", deletedMemory, recAddr)
break out
*/
require
(
1
)
receiver
:=
vm
.
state
.
GetAccount
(
stack
.
Pop
()
.
Bytes
())
receiver
.
AddAmount
(
closure
.
object
.
Amount
)
vm
.
stateManager
.
manifest
.
AddObjectChange
(
receiver
)
closure
.
object
.
state
.
Purge
()
fallthrough
case
oSTOP
:
// Stop the closure
return
closure
.
Return
(
nil
),
nil
default
:
ethutil
.
Config
.
Log
.
Debugf
(
"Invalid opcode %x
\n
"
,
op
)
...
...
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