Add blockstore skipped api (#14145)
* Add blockstore api to determine if a slot was skipped * Return custom rpc error if slot is skipped
This commit is contained in:
@ -601,7 +601,7 @@ impl JsonRpcRequestProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_blockstore_max_root<T>(
|
||||
fn check_blockstore_root<T>(
|
||||
&self,
|
||||
result: &std::result::Result<T, BlockstoreError>,
|
||||
slot: Slot,
|
||||
@ -612,7 +612,7 @@ impl JsonRpcRequestProcessor {
|
||||
if result.is_err() {
|
||||
let err = result.as_ref().unwrap_err();
|
||||
debug!(
|
||||
"check_blockstore_max_root, slot: {:?}, max root: {:?}, err: {:?}",
|
||||
"check_blockstore_root, slot: {:?}, max root: {:?}, err: {:?}",
|
||||
slot,
|
||||
self.blockstore.max_root(),
|
||||
err
|
||||
@ -620,6 +620,9 @@ impl JsonRpcRequestProcessor {
|
||||
if slot >= self.blockstore.max_root() {
|
||||
return Err(RpcCustomError::BlockNotAvailable { slot }.into());
|
||||
}
|
||||
if self.blockstore.is_skipped(slot) {
|
||||
return Err(RpcCustomError::SlotSkipped { slot }.into());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -662,7 +665,7 @@ impl JsonRpcRequestProcessor {
|
||||
.highest_confirmed_root()
|
||||
{
|
||||
let result = self.blockstore.get_confirmed_block(slot);
|
||||
self.check_blockstore_max_root(&result, slot)?;
|
||||
self.check_blockstore_root(&result, slot)?;
|
||||
if result.is_err() {
|
||||
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
|
||||
return Ok(self
|
||||
@ -768,7 +771,7 @@ impl JsonRpcRequestProcessor {
|
||||
.highest_confirmed_root()
|
||||
{
|
||||
let result = self.blockstore.get_block_time(slot);
|
||||
self.check_blockstore_max_root(&result, slot)?;
|
||||
self.check_blockstore_root(&result, slot)?;
|
||||
if result.is_err() {
|
||||
if let Some(bigtable_ledger_storage) = &self.bigtable_ledger_storage {
|
||||
return Ok(self
|
||||
|
Reference in New Issue
Block a user