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;
|
self.last_block_height = height;
|
||||||
|
|
||||||
// The only valid block without a coinbase height is the genesis block,
|
if let Some(height) = height {
|
||||||
// which omitted it by mistake. So for the purposes of routing requests,
|
if height <= self.max_checkpoint_height {
|
||||||
// we can interpret a missing coinbase height as 0; the checkpoint verifier
|
return self
|
||||||
// will reject it.
|
.checkpoint
|
||||||
if height.unwrap_or(block::Height(0)) < self.max_checkpoint_height {
|
|
||||||
self.checkpoint
|
|
||||||
.call(block)
|
.call(block)
|
||||||
.map_err(VerifyChainError::Checkpoint)
|
.map_err(VerifyChainError::Checkpoint)
|
||||||
.boxed()
|
.boxed();
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
self.block
|
||||||
.call(block)
|
.call(block)
|
||||||
.map_err(VerifyChainError::Block)
|
.map_err(VerifyChainError::Block)
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Return a block verification service, using `config`, `network` and
|
/// Return a block verification service, using `config`, `network` and
|
||||||
/// `state_service`.
|
/// `state_service`.
|
||||||
|
|
Loading…
Reference in New Issue