uses Option<Slot> for SlotMeta.parent_slot (#21808)

SlotMeta.parent_slot for the head of a detached chain of slots is
unknown and that is indicated by u64::MAX which lacks type-safety:
https://github.com/solana-labs/solana/blob/6c108c8fc/ledger/src/blockstore_meta.rs#L203-L205

The commit changes the type to Option<Slot>. Backward compatibility is
maintained by customizing serde serialize/deserialize implementations.
This commit is contained in:
behzad nouri
2021-12-14 18:57:11 +00:00
committed by GitHub
parent d13a5056f1
commit 8d980f07ba
7 changed files with 79 additions and 75 deletions

View File

@@ -201,7 +201,7 @@ fn output_slot(
println!(" Slot Meta {:?} is_full: {}", meta, is_full);
} else {
println!(
" num_shreds: {}, parent_slot: {}, num_entries: {}, is_full: {}",
" num_shreds: {}, parent_slot: {:?}, num_entries: {}, is_full: {}",
num_shreds,
meta.parent_slot,
entries.len(),