add DivergingBlockNumber in forensics report (#105)

This commit is contained in:
Jerome 2022-06-30 23:07:09 +10:00 committed by GitHub
parent 3ebaea1945
commit 86ec908091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -157,9 +157,17 @@ func (f *Forensics) SendForensicProof(chain consensus.ChainReader, engine *XDPoS
accrossEpoches = true
}
ancestorBlock := chain.GetHeaderByHash(ancestorHash)
if ancestorBlock == nil {
log.Error("[SendForensicProof] Unable to find the ancestor block by its hash", "Hash", ancestorHash)
return fmt.Errorf("Can't find ancestor block via hash")
}
content, err := json.Marshal(&types.ForensicsContent{
DivergingBlockHash: ancestorHash.Hex(),
AcrossEpoch: accrossEpoches,
DivergingBlockHash: ancestorHash.Hex(),
AcrossEpoch: accrossEpoches,
DivergingBlockNumber: ancestorBlock.Number.Uint64(),
SmallerRoundInfo: &types.ForensicsInfo{
HashPath: ancestorToLowerRoundPath,
QuorumCert: lowerRoundQC,