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
72d065d4
Commit
72d065d4
authored
Apr 20, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: force block process & fixed chain manager test
parent
97a9753f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
block_processor.go
core/block_processor.go
+14
-0
chain_manager.go
core/chain_manager.go
+6
-1
chain_manager_test.go
core/chain_manager_test.go
+4
-3
No files found.
core/block_processor.go
View file @
72d065d4
...
...
@@ -149,6 +149,20 @@ func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state
return
receipts
,
err
}
func
(
sm
*
BlockProcessor
)
RetryProcess
(
block
*
types
.
Block
)
(
logs
state
.
Logs
,
err
error
)
{
// Processing a blocks may never happen simultaneously
sm
.
mutex
.
Lock
()
defer
sm
.
mutex
.
Unlock
()
header
:=
block
.
Header
()
if
!
sm
.
bc
.
HasBlock
(
header
.
ParentHash
)
{
return
nil
,
ParentError
(
header
.
ParentHash
)
}
parent
:=
sm
.
bc
.
GetBlock
(
header
.
ParentHash
)
return
sm
.
processWithParent
(
block
,
parent
)
}
// Process block will attempt to process the given block's transactions and applies them
// on top of the block's parent state (given it exists) and will return wether it was
// successful or not.
...
...
core/chain_manager.go
View file @
72d065d4
...
...
@@ -322,7 +322,12 @@ func (self *ChainManager) Export(w io.Writer) error {
last
:=
self
.
currentBlock
.
NumberU64
()
for
nr
:=
uint64
(
0
);
nr
<=
last
;
nr
++
{
if
err
:=
self
.
GetBlockByNumber
(
nr
)
.
EncodeRLP
(
w
);
err
!=
nil
{
block
:=
self
.
GetBlockByNumber
(
nr
)
if
block
==
nil
{
return
fmt
.
Errorf
(
"export failed on #%d: not found"
,
nr
)
}
if
err
:=
block
.
EncodeRLP
(
w
);
err
!=
nil
{
return
err
}
}
...
...
core/chain_manager_test.go
View file @
72d065d4
...
...
@@ -69,15 +69,16 @@ func printChain(bc *ChainManager) {
func
testChain
(
chainB
types
.
Blocks
,
bman
*
BlockProcessor
)
(
*
big
.
Int
,
error
)
{
td
:=
new
(
big
.
Int
)
for
_
,
block
:=
range
chainB
{
td2
,
_
,
err
:=
bman
.
bc
.
processor
.
Process
(
block
)
_
,
err
:=
bman
.
bc
.
processor
.
Process
(
block
)
if
err
!=
nil
{
if
IsKnownBlockErr
(
err
)
{
continue
}
return
nil
,
err
}
block
.
Td
=
td2
td
=
td2
parent
:=
bman
.
bc
.
GetBlock
(
block
.
ParentHash
())
block
.
Td
=
CalculateTD
(
block
,
parent
)
td
=
block
.
Td
bman
.
bc
.
mu
.
Lock
()
{
...
...
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