Enable cluster tests (#3372)
* Cluster tests * stable! * fixup! stable! * fixup! fixup! stable! * fixup! fixup! fixup! stable! * fixup! fixup! fixup! fixup! stable! * fixed space * add getNumBlocksSinceSignatureConfirmation entry for the json rpc docs * Check in upcoming epochs for potential leadership slots in next_leader_slot()
This commit is contained in:
committed by
GitHub
parent
402a733cd7
commit
148e08a8a5
@ -790,13 +790,21 @@ impl Bank {
|
||||
self.accounts.transaction_count(self.accounts_id)
|
||||
}
|
||||
|
||||
pub fn get_signature_status(&self, signature: &Signature) -> Option<Result<()>> {
|
||||
pub fn get_signature_confirmation_status(
|
||||
&self,
|
||||
signature: &Signature,
|
||||
) -> Option<(usize, Result<()>)> {
|
||||
let parents = self.parents();
|
||||
let mut caches = vec![self.status_cache.read().unwrap()];
|
||||
caches.extend(parents.iter().map(|b| b.status_cache.read().unwrap()));
|
||||
StatusCache::get_signature_status_all(&caches, signature)
|
||||
}
|
||||
|
||||
pub fn get_signature_status(&self, signature: &Signature) -> Option<Result<()>> {
|
||||
self.get_signature_confirmation_status(signature)
|
||||
.map(|v| v.1)
|
||||
}
|
||||
|
||||
pub fn has_signature(&self, signature: &Signature) -> bool {
|
||||
let parents = self.parents();
|
||||
let mut caches = vec![self.status_cache.read().unwrap()];
|
||||
|
@ -192,13 +192,13 @@ impl<T: Clone> StatusCache<T> {
|
||||
pub fn get_signature_status_all<U>(
|
||||
checkpoints: &[U],
|
||||
signature: &Signature,
|
||||
) -> Option<Result<(), T>>
|
||||
) -> Option<(usize, Result<(), T>)>
|
||||
where
|
||||
U: Deref<Target = Self>,
|
||||
{
|
||||
for c in checkpoints {
|
||||
for (i, c) in checkpoints.iter().enumerate() {
|
||||
if let Some(status) = c.get_signature_status(signature) {
|
||||
return Some(status);
|
||||
return Some((i, status));
|
||||
}
|
||||
}
|
||||
None
|
||||
@ -257,7 +257,7 @@ mod tests {
|
||||
let checkpoints = [&second, &first];
|
||||
assert_eq!(
|
||||
BankStatusCache::get_signature_status_all(&checkpoints, &sig),
|
||||
Some(Ok(())),
|
||||
Some((1, Ok(()))),
|
||||
);
|
||||
assert!(StatusCache::has_signature_all(&checkpoints, &sig));
|
||||
}
|
||||
|
Reference in New Issue
Block a user