Check SlotNotRooted if confirmed block not found in blockstore or bigtable (#13776)
This commit is contained in:
parent
e3a92d6905
commit
7befad2f6d
|
@ -599,7 +599,7 @@ impl JsonRpcRequestProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_slot_cleaned_up<T>(
|
fn check_slot_blockstore_status<T>(
|
||||||
&self,
|
&self,
|
||||||
result: &std::result::Result<T, BlockstoreError>,
|
result: &std::result::Result<T, BlockstoreError>,
|
||||||
slot: Slot,
|
slot: Slot,
|
||||||
|
@ -618,6 +618,9 @@ impl JsonRpcRequestProcessor {
|
||||||
}
|
}
|
||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
|
if let BlockstoreError::SlotNotRooted = result.as_ref().unwrap_err() {
|
||||||
|
return Err(RpcCustomError::BlockNotAvailable { slot }.into());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -646,7 +649,7 @@ impl JsonRpcRequestProcessor {
|
||||||
.map(|confirmed_block| confirmed_block.encode(encoding)));
|
.map(|confirmed_block| confirmed_block.encode(encoding)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.check_slot_cleaned_up(&result, slot)?;
|
self.check_slot_blockstore_status(&result, slot)?;
|
||||||
Ok(result
|
Ok(result
|
||||||
.ok()
|
.ok()
|
||||||
.map(|confirmed_block| confirmed_block.encode(encoding)))
|
.map(|confirmed_block| confirmed_block.encode(encoding)))
|
||||||
|
@ -751,7 +754,7 @@ impl JsonRpcRequestProcessor {
|
||||||
.and_then(|confirmed_block| confirmed_block.block_time));
|
.and_then(|confirmed_block| confirmed_block.block_time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.check_slot_cleaned_up(&result, slot)?;
|
self.check_slot_blockstore_status(&result, slot)?;
|
||||||
Ok(result.ok().unwrap_or(None))
|
Ok(result.ok().unwrap_or(None))
|
||||||
} else {
|
} else {
|
||||||
Err(RpcCustomError::BlockNotAvailable { slot }.into())
|
Err(RpcCustomError::BlockNotAvailable { slot }.into())
|
||||||
|
|
Loading…
Reference in New Issue