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
c8180444
Commit
c8180444
authored
Apr 23, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call initial closure with proper tx argument
parent
ef7f3f36
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
33 deletions
+5
-33
block_chain.go
ethchain/block_chain.go
+1
-0
state_manager.go
ethchain/state_manager.go
+1
-32
vm.go
ethchain/vm.go
+3
-1
No files found.
ethchain/block_chain.go
View file @
c8180444
...
...
@@ -46,6 +46,7 @@ func (bc *BlockChain) NewBlock(coinbase []byte, txs []*Transaction) *Block {
hash
=
bc
.
LastBlockHash
lastBlockTime
=
bc
.
CurrentBlock
.
Time
}
block
:=
CreateBlock
(
root
,
hash
,
...
...
ethchain/state_manager.go
View file @
c8180444
...
...
@@ -133,37 +133,6 @@ func (sm *StateManager) ApplyTransactions(block *Block, txs []*Transaction) {
}
}
}
// Process each transaction/contract
for
_
,
tx
:=
range
txs
{
// If there's no recipient, it's a contract
// Check if this is a contract creation traction and if so
// create a contract of this tx.
if
tx
.
IsContract
()
{
contract
:=
sm
.
MakeContract
(
tx
)
if
contract
!=
nil
{
sm
.
EvalScript
(
contract
.
Init
(),
contract
,
tx
,
block
)
}
else
{
ethutil
.
Config
.
Log
.
Infoln
(
"[STATE] Unable to create contract"
)
}
}
else
{
// Figure out if the address this transaction was sent to is a
// contract or an actual account. In case of a contract, we process that
// contract instead of moving funds between accounts.
var
err
error
if
contract
:=
sm
.
procState
.
GetContract
(
tx
.
Recipient
);
contract
!=
nil
{
err
=
sm
.
Ethereum
.
TxPool
()
.
ProcessTransaction
(
tx
,
block
,
true
)
if
err
==
nil
{
sm
.
EvalScript
(
contract
.
Script
(),
contract
,
tx
,
block
)
}
}
else
{
err
=
sm
.
Ethereum
.
TxPool
()
.
ProcessTransaction
(
tx
,
block
,
false
)
}
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Infoln
(
"[STATE]"
,
err
)
}
}
}
}
// The prepare function, prepares the state manager for the next
...
...
@@ -359,7 +328,7 @@ func (sm *StateManager) EvalScript(script []byte, object *StateObject, tx *Trans
Diff
:
block
.
Difficulty
,
//Price: tx.GasPrice,
})
closure
.
Call
(
vm
,
nil
,
nil
)
closure
.
Call
(
vm
,
tx
.
Data
,
nil
)
// Update the account (refunds)
sm
.
procState
.
UpdateStateObject
(
caller
)
...
...
ethchain/vm.go
View file @
c8180444
...
...
@@ -53,11 +53,12 @@ var isRequireError = false
func
(
vm
*
Vm
)
RunClosure
(
closure
*
Closure
,
hook
DebugHook
)
(
ret
[]
byte
,
err
error
)
{
// Recover from any require exception
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
&&
isRequireError
{
if
r
:=
recover
();
r
!=
nil
/*&& isRequireError*/
{
fmt
.
Println
(
r
)
ret
=
closure
.
Return
(
nil
)
err
=
fmt
.
Errorf
(
"%v"
,
r
)
fmt
.
Println
(
"vm err"
,
err
)
}
}()
...
...
@@ -315,6 +316,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case
oCALLDATALOAD
:
require
(
1
)
offset
:=
stack
.
Pop
()
.
Int64
()
fmt
.
Println
(
closure
.
Args
)
val
:=
closure
.
Args
[
offset
:
offset
+
31
]
stack
.
Push
(
ethutil
.
BigD
(
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