Send the final checkpoint block to the checkpoint verifier (#1111)
* Send the final checkpoint block to the checkpoint verifier Also: * route blocks with no height to the block verifier * update an incorrect comment * Add missing { * rustfmt
This commit is contained in:
parent
41b985ee0b
commit
2db97ba6e4
|
@ -107,23 +107,28 @@ where
|
|||
|
||||
self.last_block_height = height;
|
||||
|
||||
// The only valid block without a coinbase height is the genesis block,
|
||||
// which omitted it by mistake. So for the purposes of routing requests,
|
||||
// we can interpret a missing coinbase height as 0; the checkpoint verifier
|
||||
// will reject it.
|
||||
if height.unwrap_or(block::Height(0)) < self.max_checkpoint_height {
|
||||
self.checkpoint
|
||||
if let Some(height) = height {
|
||||
if height <= self.max_checkpoint_height {
|
||||
return self
|
||||
.checkpoint
|
||||
.call(block)
|
||||
.map_err(VerifyChainError::Checkpoint)
|
||||
.boxed()
|
||||
} else {
|
||||
.boxed();
|
||||
}
|
||||
}
|
||||
|
||||
// For the purposes of routing requests, we can send blocks
|
||||
// with no height to the block verifier, which will reject them.
|
||||
//
|
||||
// We choose the block verifier because it doesn't have any
|
||||
// internal state, so it will always return the same error for a
|
||||
// block with no height.
|
||||
self.block
|
||||
.call(block)
|
||||
.map_err(VerifyChainError::Block)
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a block verification service, using `config`, `network` and
|
||||
/// `state_service`.
|
||||
|
|
Loading…
Reference in New Issue