Replaces ReadAccountMapEntry in do_scan_secondary_index()
Problem
See https://github.com/solana-labs/solana/issues/34786 for background.
We want to limit the use of ReadAccountMapEntry, from AccountsIndex, everywhere. Ultimately removing it once there are no more uses.
When scanning a secondary index, we look up each pubkey in the index and then apply a callback function to the entry if found. Currently this uses ReadAccountMapEntry via AccountsIndex::get(), but we can do it other ways without ReadAccountMapEntry.
Summary of Changes
Adds get_with_and_then() and uses it in do_scan_secondary_index()
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 81.7%. Comparing base (
da08868) to head (604162f). Report is 1 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #35219 +/- ##
=========================================
- Coverage 81.7% 81.7% -0.1%
=========================================
Files 834 834
Lines 224244 224249 +5
=========================================
- Hits 183398 183381 -17
- Misses 40846 40868 +22
I rebased and force-pushed this branch to pull in #35307.
@HaoranYi @jeffwashington This PR is now ready for a re-review.
Rebased on top of #35336, so that I can use get_account_info_with_and_then() in the impl of this PR.
@HaoranYi @jeffwashington This PR is ready for re-review. Thanks!