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
055407c8
Commit
055407c8
authored
Jan 03, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VM Recovery
parent
78d18b13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
block_manager.go
block_manager.go
+20
-4
No files found.
block_manager.go
View file @
055407c8
...
...
@@ -11,7 +11,7 @@
package
main
import
(
_
"fmt"
"fmt"
)
type
BlockManager
struct
{
...
...
@@ -33,7 +33,13 @@ func (bm *BlockManager) ProcessBlock(block *Block) error {
// Process each transaction/contract
for
_
,
tx
:=
range
block
.
transactions
{
go
bm
.
ProcessTransaction
(
tx
,
block
,
lockChan
)
// If there's no recipient, it's a contract
if
tx
.
recipient
==
""
{
go
bm
.
ProcessContract
(
tx
,
block
,
lockChan
)
}
else
{
// "finish" tx which isn't a contract
lockChan
<-
true
}
}
// Wait for all Tx to finish processing
...
...
@@ -44,8 +50,18 @@ func (bm *BlockManager) ProcessBlock(block *Block) error {
return
nil
}
func
(
bm
*
BlockManager
)
ProcessTransaction
(
tx
*
Transaction
,
block
*
Block
,
lockChan
chan
bool
)
{
bm
.
vm
.
RunTransaction
(
tx
,
block
,
func
(
opType
OpType
)
bool
{
func
(
bm
*
BlockManager
)
ProcessContract
(
tx
*
Transaction
,
block
*
Block
,
lockChan
chan
bool
)
{
// Recovering function in case the VM had any errors
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
fmt
.
Println
(
"Recovered from VM execution with err ="
,
r
)
// Let the channel know where done even though it failed (so the execution may resume normally)
lockChan
<-
true
}
}()
// Process contract
bm
.
vm
.
ProcContract
(
tx
,
block
,
func
(
opType
OpType
)
bool
{
// TODO calculate fees
return
true
// Continue
...
...
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