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
12b90600
Commit
12b90600
authored
May 28, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: moved guards
parent
2587b0ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
chain_manager.go
core/chain_manager.go
+8
-9
No files found.
core/chain_manager.go
View file @
12b90600
...
...
@@ -680,21 +680,20 @@ func (self *ChainManager) diff(oldBlock, newBlock *types.Block) (types.Blocks, e
// first reduce whoever is higher bound
if
oldBlock
.
NumberU64
()
>
newBlock
.
NumberU64
()
{
// reduce old chain
for
oldBlock
=
oldBlock
;
oldBlock
.
NumberU64
()
!=
newBlock
.
NumberU64
();
oldBlock
=
self
.
GetBlock
(
oldBlock
.
ParentHash
())
{
if
oldBlock
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Invalid old chain"
)
}
for
oldBlock
=
oldBlock
;
oldBlock
!=
nil
&&
oldBlock
.
NumberU64
()
!=
newBlock
.
NumberU64
();
oldBlock
=
self
.
GetBlock
(
oldBlock
.
ParentHash
())
{
}
}
else
{
// reduce new chain and append new chain blocks for inserting later on
for
newBlock
=
newBlock
;
newBlock
.
NumberU64
()
!=
oldBlock
.
NumberU64
();
newBlock
=
self
.
GetBlock
(
newBlock
.
ParentHash
())
{
if
newBlock
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Invalid new chain"
)
}
for
newBlock
=
newBlock
;
newBlock
!=
nil
&&
newBlock
.
NumberU64
()
!=
oldBlock
.
NumberU64
();
newBlock
=
self
.
GetBlock
(
newBlock
.
ParentHash
())
{
newChain
=
append
(
newChain
,
newBlock
)
}
}
if
oldBlock
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Invalid old chain"
)
}
if
newBlock
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Invalid new chain"
)
}
numSplit
:=
newBlock
.
Number
()
for
{
...
...
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