Improve UX querying rpc for blocks at or before the snapshot from boot (#23403)

* Bump first-available block to first complete block

* Remove obsolete purges in tests (PrimaryIndex toggling no longer in use

* Check first-available block in Rpc check_slot_cleaned_up
This commit is contained in:
Tyera Eulberg
2022-02-28 23:57:41 -07:00
committed by GitHub
parent 19448ba078
commit 3b5b71ce44
2 changed files with 22 additions and 18 deletions

View File

@ -941,15 +941,20 @@ impl JsonRpcRequestProcessor {
result: &std::result::Result<T, BlockstoreError>,
slot: Slot,
) -> Result<()> {
let first_available_block = self
.blockstore
.get_first_available_block()
.unwrap_or_default();
let err: Error = RpcCustomError::BlockCleanedUp {
slot,
first_available_block,
}
.into();
if let Err(BlockstoreError::SlotCleanedUp) = result {
return Err(RpcCustomError::BlockCleanedUp {
slot,
first_available_block: self
.blockstore
.get_first_available_block()
.unwrap_or_default(),
}
.into());
return Err(err);
}
if slot < first_available_block {
return Err(err);
}
Ok(())
}