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
2784e256
Commit
2784e256
authored
Jul 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vm logging on diff
parent
50bc8380
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
+20
-9
state_manager.go
ethchain/state_manager.go
+1
-1
transaction.go
ethchain/transaction.go
+0
-4
vm.go
ethchain/vm.go
+6
-4
value.go
ethutil/value.go
+13
-0
No files found.
ethchain/state_manager.go
View file @
2784e256
...
...
@@ -196,7 +196,7 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) {
fmt
.
Printf
(
"## %x %x ##
\n
"
,
block
.
Hash
(),
block
.
Number
)
}
receipts
,
err
:
=
sm
.
ApplyDiff
(
state
,
parent
,
block
)
_
,
err
=
sm
.
ApplyDiff
(
state
,
parent
,
block
)
if
err
!=
nil
{
return
err
}
...
...
ethchain/transaction.go
View file @
2784e256
...
...
@@ -232,10 +232,6 @@ func (self *Receipt) Cmp(other *Receipt) bool {
return
false
}
if
self
.
CumulativeGasUsed
.
Cmp
(
other
.
CumulativeGasUsed
)
!=
0
{
return
false
}
return
true
}
...
...
ethchain/vm.go
View file @
2784e256
...
...
@@ -184,7 +184,8 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
var
mult
*
big
.
Int
y
,
x
:=
stack
.
Peekn
()
val
:=
closure
.
GetStorage
(
x
)
if
val
.
IsEmpty
()
&&
len
(
y
.
Bytes
())
>
0
{
//if val.IsEmpty() && len(y.Bytes()) > 0 {
if
val
.
BigInt
()
.
Cmp
(
ethutil
.
Big0
)
==
0
&&
len
(
y
.
Bytes
())
>
0
{
mult
=
ethutil
.
Big2
}
else
if
!
val
.
IsEmpty
()
&&
len
(
y
.
Bytes
())
==
0
{
mult
=
ethutil
.
Big0
...
...
@@ -482,7 +483,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
case
ORIGIN
:
stack
.
Push
(
ethutil
.
BigD
(
vm
.
vars
.
Origin
))
vm
.
Printf
(
" => %
v
"
,
vm
.
vars
.
Origin
)
vm
.
Printf
(
" => %
x
"
,
vm
.
vars
.
Origin
)
case
CALLER
:
caller
:=
closure
.
caller
.
Address
()
stack
.
Push
(
ethutil
.
BigD
(
caller
))
...
...
@@ -550,10 +551,10 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
}
code
:=
closure
.
Script
[
cOff
:
cOff
+
l
]
fmt
.
Println
(
"len:"
,
l
,
"code off:"
,
cOff
,
"mem off:"
,
mOff
)
//
fmt.Println("len:", l, "code off:", cOff, "mem off:", mOff)
mem
.
Set
(
mOff
,
l
,
code
)
fmt
.
Println
(
Code
(
mem
.
Get
(
mOff
,
l
)))
//
fmt.Println(Code(mem.Get(mOff, l)))
case
GASPRICE
:
stack
.
Push
(
closure
.
Price
)
...
...
@@ -743,6 +744,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
if
closure
.
object
.
Amount
.
Cmp
(
value
)
<
0
{
vmlogger
.
Debugf
(
"Insufficient funds to transfer value. Req %v, has %v"
,
value
,
closure
.
object
.
Amount
)
closure
.
ReturnGas
(
gas
,
nil
,
nil
)
stack
.
Push
(
ethutil
.
BigFalse
)
...
...
ethutil/value.go
View file @
2784e256
...
...
@@ -190,6 +190,19 @@ func (val *Value) Get(idx int) *Value {
return
NewValue
(
nil
)
}
func
(
self
*
Value
)
Copy
()
*
Value
{
switch
val
:=
self
.
Val
.
(
type
)
{
case
*
big
.
Int
:
return
NewValue
(
new
(
big
.
Int
)
.
Set
(
val
))
case
[]
byte
:
return
NewValue
(
CopyBytes
(
val
))
default
:
return
NewValue
(
self
.
Val
)
}
return
nil
}
func
(
val
*
Value
)
Cmp
(
o
*
Value
)
bool
{
return
reflect
.
DeepEqual
(
val
.
Val
,
o
.
Val
)
}
...
...
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