Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockmanager: avoid dereferencing nil checkpoint hash #105

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions blockmanager.go
Expand Up @@ -493,19 +493,18 @@ waitForHeaders:
// checkpoints last time, we must query our peers again.
if minCheckpointHeight(allCFCheckpoints) < lastHeight {
// Start by getting the filter checkpoints up to the
// latest block checkpoint we have for this chain. We
// do this so we don't have to fetch all filter
// checkpoints each time our block header chain
// advances. If our block header chain has already
// advanced past the last block checkpoint, we must
// fetch filter checkpoints to our last header hash.
// height of our block header chain. If we have a chain
// checkpoint that is past this height, we use that
// instead. We do this so we don't have to fetch all
// filter checkpoints each time our block header chain
// advances.
// TODO(halseth): fetch filter checkpoints up to the
// best block of the connected peers.
bestHeight := uint32(lastCp.Height)
bestHash := *lastCp.Hash
if bestHeight < lastHeight {
bestHeight = lastHeight
bestHash = lastHash
bestHeight := lastHeight
bestHash := lastHash
if bestHeight < uint32(lastCp.Height) {
bestHeight = uint32(lastCp.Height)
bestHash = *lastCp.Hash
}

log.Debugf("Getting filter checkpoints up to "+
Expand Down