Skip to content

Commit

Permalink
Add early return to Blockstore::find_address_signatures methods (#33545)
Browse files Browse the repository at this point in the history
Add early return to find_address_signatures methods
  • Loading branch information
CriesofCarrots authored Oct 5, 2023
1 parent 666ce9b commit 6f1922b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6f1922b

Please sign in to comment.