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:
@@ -2761,7 +2761,7 @@ fn test_no_voting() {
|
||||
let meta = ledger.meta(i as u64).unwrap().unwrap();
|
||||
let parent = meta.parent_slot;
|
||||
let expected_parent = i.saturating_sub(1);
|
||||
assert_eq!(parent, expected_parent as u64);
|
||||
assert_eq!(parent, Some(expected_parent as u64));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user