Add early return to Blockstore::find_address_signatures methods (#33545)

Add early return to find_address_signatures methods
This commit is contained in:
Tyera 2023-10-05 13:57:35 -06:00 committed by GitHub
parent 666ce9b3be
commit 6f1922b4fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -2474,8 +2474,10 @@ impl Blockstore {
end_slot: Slot,
) -> Result<Vec<(Slot, Signature)>> {
let (lock, lowest_available_slot) = self.ensure_lowest_cleanup_slot();
let mut signatures: Vec<(Slot, Signature)> = vec![];
if end_slot < lowest_available_slot {
return Ok(signatures);
}
for transaction_status_cf_primary_index in 0..=1 {
let index_iterator = self.address_signatures_cf.iter(IteratorMode::From(
(
@ -2511,12 +2513,15 @@ impl Blockstore {
) -> Result<Vec<(Slot, Signature)>> {
let (lock, lowest_available_slot) = self.ensure_lowest_cleanup_slot();
let mut signatures: Vec<(Slot, Signature)> = vec![];
if slot < lowest_available_slot {
return Ok(signatures);
}
for transaction_status_cf_primary_index in 0..=1 {
let index_iterator = self.address_signatures_cf.iter(IteratorMode::From(
(
transaction_status_cf_primary_index,
pubkey,
slot.max(lowest_available_slot),
slot,
Signature::default(),
),
IteratorDirection::Forward,