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:
@ -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)
|
||||
|
Reference in New Issue
Block a user