Check SlotNotRooted if confirmed block not found in blockstore or bigtable (#13776)

This commit is contained in:
Tyera Eulberg 2020-11-23 20:36:20 -07:00 committed by GitHub
parent e3a92d6905
commit 7befad2f6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -599,7 +599,7 @@ impl JsonRpcRequestProcessor {
}
}
fn check_slot_cleaned_up<T>(
fn check_slot_blockstore_status<T>(
&self,
result: &std::result::Result<T, BlockstoreError>,
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())