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
5198b7b9
Commit
5198b7b9
authored
Dec 28, 2013
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test code updated
parent
bd582d91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
ethereum.go
ethereum.go
+9
-2
vm.go
vm.go
+9
-9
No files found.
ethereum.go
View file @
5198b7b9
...
@@ -4,6 +4,8 @@ import (
...
@@ -4,6 +4,8 @@ import (
"fmt"
"fmt"
)
)
const
Debug
=
false
func
main
()
{
func
main
()
{
InitFees
()
InitFees
()
...
@@ -35,6 +37,11 @@ func main() {
...
@@ -35,6 +37,11 @@ func main() {
bm
.
ProcessBlock
(
blck
)
bm
.
ProcessBlock
(
blck
)
//t := blck.MarshalRlp()
//blck.UnmarshalRlp(t)
t
:=
blck
.
MarshalRlp
()
copyBlock
:=
&
Block
{}
copyBlock
.
UnmarshalRlp
(
t
)
fmt
.
Println
(
blck
)
fmt
.
Println
(
copyBlock
)
}
}
vm.go
View file @
5198b7b9
...
@@ -64,10 +64,7 @@ type Vm struct {
...
@@ -64,10 +64,7 @@ type Vm struct {
}
}
func
NewVm
()
*
Vm
{
func
NewVm
()
*
Vm
{
fmt
.
Println
(
"init Ethereum VM"
)
//stackSize := uint(256)
stackSize
:=
uint
(
256
)
fmt
.
Println
(
"stack size ="
,
stackSize
)
return
&
Vm
{
return
&
Vm
{
stack
:
make
(
map
[
string
]
string
),
stack
:
make
(
map
[
string
]
string
),
...
@@ -76,10 +73,12 @@ func NewVm() *Vm {
...
@@ -76,10 +73,12 @@ func NewVm() *Vm {
}
}
func
(
vm
*
Vm
)
RunTransaction
(
tx
*
Transaction
,
cb
TxCallback
)
{
func
(
vm
*
Vm
)
RunTransaction
(
tx
*
Transaction
,
cb
TxCallback
)
{
fmt
.
Printf
(
`
if
Debug
{
fmt
.
Printf
(
`
# processing Tx (%v)
# processing Tx (%v)
# fee = %f, ops = %d, sender = %s, value = %d
# fee = %f, ops = %d, sender = %s, value = %d
`
,
tx
.
addr
,
float32
(
tx
.
fee
)
/
1e8
,
len
(
tx
.
data
),
tx
.
sender
,
tx
.
value
)
`
,
tx
.
addr
,
float32
(
tx
.
fee
)
/
1e8
,
len
(
tx
.
data
),
tx
.
sender
,
tx
.
value
)
}
vm
.
stack
=
make
(
map
[
string
]
string
)
vm
.
stack
=
make
(
map
[
string
]
string
)
vm
.
stack
[
"0"
]
=
tx
.
sender
vm
.
stack
[
"0"
]
=
tx
.
sender
...
@@ -102,7 +101,9 @@ out:
...
@@ -102,7 +101,9 @@ out:
// XXX Should Instr return big int slice instead of string slice?
// XXX Should Instr return big int slice instead of string slice?
op
,
args
,
_
:=
Instr
(
tx
.
data
[
stPtr
])
op
,
args
,
_
:=
Instr
(
tx
.
data
[
stPtr
])
fmt
.
Printf
(
"%-3d %d %v
\n
"
,
stPtr
,
op
,
args
)
if
Debug
{
fmt
.
Printf
(
"%-3d %d %v
\n
"
,
stPtr
,
op
,
args
)
}
opType
:=
OpType
(
tNorm
)
opType
:=
OpType
(
tNorm
)
// Determine the op type (used for calculating fees by the block manager)
// Determine the op type (used for calculating fees by the block manager)
...
@@ -178,8 +179,7 @@ out:
...
@@ -178,8 +179,7 @@ out:
stPtr
++
stPtr
++
}
else
{
}
else
{
stPtr
=
nptr
stPtr
=
nptr
fmt
.
Println
(
"... JMP"
,
nptr
,
"..."
)
if
Debug
{
fmt
.
Println
(
"... JMP"
,
nptr
,
"..."
)
}
}
}
}
}
fmt
.
Println
(
"# finished processing Tx
\n
"
)
}
}
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