Skip to content

Commit

Permalink
blockchain & headerchain: letting uncles pass in checkCanonical and u…
Browse files Browse the repository at this point in the history
…sing PCCOP in headerchain CalcTd instead of PCRC to retrieve PTZ
  • Loading branch information
shreekarashastry committed Jul 21, 2022
1 parent f48053c commit 81633a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3531,7 +3531,7 @@ func (bc *BlockChain) CheckCanonical(header *types.Header, order int) error {
case quaiclient.UnknownStatTy:
return errors.New("dominant chain not synced")
default:
return errors.New("subordinate is not canonical in dom")
return errors.New("dominant chain not synced")
}
}

Expand Down
5 changes: 2 additions & 3 deletions core/headerchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,18 +716,17 @@ func (hc *HeaderChain) HLCR(localDifficulties []*big.Int, externDifficulties []*
// CalcTd calculates the TD of the given header using PCRC and CalcHLCRNetDifficulty.
func (hc *HeaderChain) CalcTd(header *types.Header) ([]*big.Int, error) {
// Check PCRC for the external block and return the terminal hash and net difficulties
externTerminalHash, err := hc.PCRC(header)
externTerminalHeader, err := hc.Engine().PreviousCoincidentOnPath(hc, header, header.Location, params.PRIME, params.ZONE, true)
if err != nil {
return nil, err
}

// Use HLCR to compute net total difficulty
externNd, err := hc.CalcHLCRNetDifficulty(externTerminalHash, header)
externNd, err := hc.CalcHLCRNetDifficulty(externTerminalHeader.Hash(), header)
if err != nil {
return nil, err
}

externTerminalHeader := hc.GetHeaderByHash(externTerminalHash)
externTd, err := hc.NdToTd(externTerminalHeader, externNd)
if err != nil {
return nil, err
Expand Down

0 comments on commit 81633a8

Please sign in to comment.