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
ca6c8c2a
Commit
ca6c8c2a
authored
Jul 03, 2019
by
gary rong
Committed by
Péter Szilágyi
Jul 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix receipt insertion (#19764)
parent
802074cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
blockchain.go
core/blockchain.go
+9
-5
No files found.
core/blockchain.go
View file @
ca6c8c2a
...
...
@@ -930,6 +930,8 @@ func (bc *BlockChain) truncateAncient(head uint64) error {
// InsertReceiptChain attempts to complete an already existing header chain with
// transaction and receipt data.
func
(
bc
*
BlockChain
)
InsertReceiptChain
(
blockChain
types
.
Blocks
,
receiptChain
[]
types
.
Receipts
,
ancientLimit
uint64
)
(
int
,
error
)
{
// We don't require the chainMu here since we want to maximize the
// concurrency of header insertion and receipt insertion.
bc
.
wg
.
Add
(
1
)
defer
bc
.
wg
.
Done
()
...
...
@@ -962,19 +964,21 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [
// updateHead updates the head fast sync block if the inserted blocks are better
// and returns a indicator whether the inserted blocks are canonical.
updateHead
:=
func
(
head
*
types
.
Block
)
bool
{
var
isCanonical
bool
bc
.
chainmu
.
Lock
()
if
td
:=
bc
.
GetTd
(
head
.
Hash
(),
head
.
NumberU64
());
td
!=
nil
{
// Rewind may have occurred, skip in that case
currentFastBlock
:=
bc
.
CurrentFastBlock
()
// Rewind may have occurred, skip in that case.
if
bc
.
CurrentHeader
()
.
Number
.
Cmp
(
head
.
Number
())
>=
0
{
currentFastBlock
,
td
:=
bc
.
CurrentFastBlock
(),
bc
.
GetTd
(
head
.
Hash
(),
head
.
NumberU64
())
if
bc
.
GetTd
(
currentFastBlock
.
Hash
(),
currentFastBlock
.
NumberU64
())
.
Cmp
(
td
)
<
0
{
rawdb
.
WriteHeadFastBlockHash
(
bc
.
db
,
head
.
Hash
())
bc
.
currentFastBlock
.
Store
(
head
)
headFastBlockGauge
.
Update
(
int64
(
head
.
NumberU64
()))
isCanonical
=
true
bc
.
chainmu
.
Unlock
()
return
true
}
}
bc
.
chainmu
.
Unlock
()
return
isCanonical
return
false
}
// writeAncient writes blockchain and corresponding receipt chain into ancient store.
//
...
...
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