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
18cc3533
Commit
18cc3533
authored
Feb 21, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed contract running
parent
681eacaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
block_manager.go
ethchain/block_manager.go
+10
-8
block_manager_test.go
ethchain/block_manager_test.go
+0
-1
No files found.
ethchain/block_manager.go
View file @
18cc3533
...
...
@@ -321,19 +321,20 @@ func (bm *BlockManager) ProcContract(tx *Transaction, block *Block, cb TxCallbac
stepcount
:=
0
totalFee
:=
new
(
big
.
Int
)
// helper function for getting a contract's memory address
getMem
:=
func
(
num
int
)
*
ethutil
.
Value
{
nb
:=
ethutil
.
BigToBytes
(
big
.
NewInt
(
int64
(
num
)),
256
)
return
contract
.
Addr
(
nb
)
}
out
:
for
{
stepcount
++
// The base big int for all calculations. Use this for any results.
base
:=
new
(
big
.
Int
)
// XXX Should Instr return big int slice instead of string slice?
// Get the next instruction from the contract
nb
:=
ethutil
.
BigToBytes
(
big
.
NewInt
(
int64
(
pc
)),
256
)
r
:=
contract
.
State
()
.
Get
(
string
(
nb
))
v
:=
ethutil
.
NewValueFromBytes
([]
byte
(
r
))
val
:=
getMem
(
pc
)
//fmt.Printf("%x = %d, %v %x\n", r, len(r), v, nb)
o
:=
v
.
Uint
()
op
:=
OpCode
(
o
)
op
:=
OpCode
(
val
.
Uint
())
var
fee
*
big
.
Int
=
new
(
big
.
Int
)
var
fee2
*
big
.
Int
=
new
(
big
.
Int
)
...
...
@@ -378,6 +379,7 @@ out:
switch
op
{
case
oSTOP
:
fmt
.
Println
(
""
)
break
out
case
oADD
:
x
,
y
:=
bm
.
stack
.
Popn
()
...
...
@@ -580,7 +582,7 @@ out:
case
oECVALID
:
case
oPUSH
:
pc
++
bm
.
stack
.
Push
(
bm
.
mem
[
strconv
.
Itoa
(
pc
)]
)
bm
.
stack
.
Push
(
getMem
(
pc
)
.
BigInt
()
)
case
oPOP
:
// Pop current value of the stack
bm
.
stack
.
Pop
()
...
...
ethchain/block_manager_test.go
View file @
18cc3533
...
...
@@ -22,7 +22,6 @@ func TestVm(t *testing.T) {
"1"
,
"PUSH"
,
"2"
,
"STOP"
,
})
bm
.
ApplyTransactions
(
block
,
[]
*
Transaction
{
ctrct
})
...
...
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