From 7befad2f6da150c59bc850d3dfc8da4f436c29c8 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Mon, 23 Nov 2020 20:36:20 -0700 Subject: [PATCH] Check SlotNotRooted if confirmed block not found in blockstore or bigtable (#13776) --- core/src/rpc.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/rpc.rs b/core/src/rpc.rs index 8e35ef4329..587deeeb86 100644 --- a/core/src/rpc.rs +++ b/core/src/rpc.rs @@ -599,7 +599,7 @@ impl JsonRpcRequestProcessor { } } - fn check_slot_cleaned_up( + fn check_slot_blockstore_status( &self, result: &std::result::Result, slot: Slot, @@ -618,6 +618,9 @@ impl JsonRpcRequestProcessor { } .into()); } + if let BlockstoreError::SlotNotRooted = result.as_ref().unwrap_err() { + return Err(RpcCustomError::BlockNotAvailable { slot }.into()); + } } Ok(()) } @@ -646,7 +649,7 @@ impl JsonRpcRequestProcessor { .map(|confirmed_block| confirmed_block.encode(encoding))); } } - self.check_slot_cleaned_up(&result, slot)?; + self.check_slot_blockstore_status(&result, slot)?; Ok(result .ok() .map(|confirmed_block| confirmed_block.encode(encoding))) @@ -751,7 +754,7 @@ impl JsonRpcRequestProcessor { .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)) } else { Err(RpcCustomError::BlockNotAvailable { slot }.into())