Skip to content

Commit

Permalink
blockchain.go: moved CheckCanonical after PCRC
Browse files Browse the repository at this point in the history
  • Loading branch information
alanorwick committed Jul 21, 2022
1 parent 76e639d commit 29506f8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2200,29 +2200,29 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool, setHead

fmt.Println("Running CheckCanonical and PCRC for block", block.Header().Number, block.Header().Location, block.Header().Hash())

err = bc.CheckCanonical(block.Header(), order)
_, err = bc.PCRC(block.Header(), order)
if err != nil {
if err.Error() == "dominant chain not synced" {
fmt.Println("dom not synced, adding to future blocks", block.Header().Hash())
if err.Error() == "slice is not synced" {
fmt.Println("adding to future blocks", block.Header().Hash())
if err := bc.addFutureBlock(block); err != nil {
return it.index, err
}
return it.index, nil
} else {
bc.futureBlocks.Remove(block.Hash())
return it.index, err
}
}

_, err = bc.PCRC(block.Header(), order)
err = bc.CheckCanonical(block.Header(), order)
if err != nil {
if err.Error() == "slice is not synced" {
fmt.Println("adding to future blocks", block.Header().Hash())
if err.Error() == "dominant chain not synced" {
fmt.Println("dom not synced, adding to future blocks", block.Header().Hash())
if err := bc.addFutureBlock(block); err != nil {
return it.index, err
}
return it.index, nil
} else {
bc.futureBlocks.Remove(block.Hash())
return it.index, err
}
}
Expand Down

0 comments on commit 29506f8

Please sign in to comment.