Add Bank::get_signature_status_with_blockhash() (#13167)

Get the signature status in O(1) time, instead of O(n) where
n is the number of blockhashes in the StatusCache.
This commit is contained in:
Greg Fitzgerald
2020-10-26 17:52:57 -06:00
committed by GitHub
parent c4fb77f057
commit f58bc8589d
2 changed files with 19 additions and 5 deletions

View File

@ -3466,6 +3466,17 @@ impl Bank {
None
}
pub fn get_signature_status_with_blockhash(
&self,
signature: &Signature,
blockhash: &Hash,
) -> Option<Result<()>> {
let rcache = self.src.status_cache.read().unwrap();
rcache
.get_signature_status(signature, blockhash, &self.ancestors)
.map(|v| v.1)
}
pub fn get_signature_status_slot(&self, signature: &Signature) -> Option<(Slot, Result<()>)> {
let rcache = self.src.status_cache.read().unwrap();
rcache.get_signature_slot(signature, &self.ancestors)