Fixup AncestorIterator method (bp #16357) (#16359)

* Fixup iterator method (#16357)

(cherry picked from commit 1a13d22984)

* Only get Blockstore::last_root once (#16362)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
This commit is contained in:
mergify[bot]
2021-04-05 05:27:58 +00:00
committed by GitHub
parent 5da83c1491
commit c8bb13b3f7

View File

@ -2053,9 +2053,10 @@ impl Blockstore {
"blockstore-rpc-api",
("method", "get_complete_transaction".to_string(), String)
);
let last_root = self.last_root();
let confirmed_unrooted_slots: Vec<_> =
AncestorIterator::new_inclusive(highest_confirmed_slot, self)
.filter(|&slot| slot > self.last_root())
.take_while(|&slot| slot > last_root)
.collect();
self.get_transaction_with_status(signature, &confirmed_unrooted_slots)
}
@ -2213,8 +2214,9 @@ impl Blockstore {
String
)
);
let last_root = self.last_root();
let confirmed_unrooted_slots: Vec<_> = AncestorIterator::new_inclusive(highest_slot, self)
.filter(|&slot| slot > self.last_root())
.take_while(|&slot| slot > last_root)
.collect();
// Figure the `slot` to start listing signatures at, based on the ledger location of the