We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
CheckPoint::insert
1 parent 8760653 commit 34fa146Copy full SHA for 34fa146
crates/core/src/checkpoint.rs
@@ -173,15 +173,14 @@ impl CheckPoint {
173
/// passed in. Of course, if the `block_id` was already present then this just returns `self`.
174
#[must_use]
175
pub fn insert(self, block_id: BlockId) -> Self {
176
- assert_ne!(block_id.height, 0, "cannot insert the genesis block");
177
-
178
let mut cp = self.clone();
179
let mut tail = vec![];
180
let base = loop {
181
if cp.height() == block_id.height {
182
if cp.hash() == block_id.hash {
183
return self;
184
}
+ assert_ne!(cp.height(), 0, "cannot replace genesis block");
185
// if we have a conflict we just return the inserted block because the tail is by
186
// implication invalid.
187
tail = vec![];
0 commit comments