@@ -37,9 +37,9 @@ getAppLedgerVersion(Application::pointer app)
3737
3838void
3939addLiveBatchAndUpdateSnapshot (Application& app, LedgerHeader header,
40- std::vector<LedgerEntry> const & initEntries,
41- std::vector<LedgerEntry> const & liveEntries,
42- std::vector<LedgerKey> const & deadEntries)
40+ LedgerEntryRefs initEntries,
41+ LedgerEntryRefs liveEntries,
42+ LedgerKeyRefs deadEntries)
4343{
4444 auto & liveBl = app.getBucketManager ().getLiveBucketList ();
4545 liveBl.addBatch (app, header.ledgerSeq , header.ledgerVersion , initEntries,
@@ -48,6 +48,18 @@ addLiveBatchAndUpdateSnapshot(Application& app, LedgerHeader header,
4848 app.getLedgerManager ().updateCanonicalStateForTesting (header);
4949}
5050
51+ void
52+ addLiveBatchAndUpdateSnapshot (Application& app, LedgerHeader header,
53+ std::vector<LedgerEntry> const & initEntries,
54+ std::vector<LedgerEntry> const & liveEntries,
55+ std::vector<LedgerKey> const & deadEntries)
56+ {
57+ auto initRefs = toRefs (initEntries);
58+ auto liveRefs = toRefs (liveEntries);
59+ auto deadRefs = toRefs (deadEntries);
60+ addLiveBatchAndUpdateSnapshot (app, header, initRefs, liveRefs, deadRefs);
61+ }
62+
5163void
5264addHotArchiveBatchAndUpdateSnapshot (
5365 Application& app, LedgerHeader header,
@@ -181,8 +193,8 @@ LedgerManagerForBucketTests::finalizeLedgerTxnChanges(
181193 if (mUseTestEntries )
182194 {
183195 // Seal the ltx but throw its entries away.
184- std::vector<LedgerEntry> init, live;
185- std::vector<LedgerKey> dead;
196+ LedgerEntryRefVec init, live;
197+ LedgerKeyRefVec dead;
186198
187199 // Any V20 features must be behind initialLedgerVers check, see comment
188200 // in LedgerManagerImpl::ledgerClosed
@@ -262,7 +274,7 @@ LedgerManagerForBucketTests::finalizeLedgerTxnChanges(
262274 // Seal the ltx and collect its entries, but don't load Soroban
263275 // config yet -- test entries (including network config like eviction
264276 // iterator) are added directly to the BucketList below, not via ltx.
265- ltx.getAllEntries (init, live, dead);
277+ ltx.sealAndBorrowAllEntries (init, live, dead);
266278
267279 // Add dead entries from ltx to entries that will be added to BucketList
268280 // so we can test background eviction properly
@@ -280,7 +292,7 @@ LedgerManagerForBucketTests::finalizeLedgerTxnChanges(
280292 // When the actual entries have the same key as test entries, we
281293 // override the actual entries with the test entries (here we
282294 // just don't add the actual entries if they're already present).
283- for (auto const & liveEntry : live)
295+ for (LedgerEntry const & liveEntry : live)
284296 {
285297 if (std::find_if (mTestLiveEntries .begin (),
286298 mTestLiveEntries .end (),
@@ -295,12 +307,15 @@ LedgerManagerForBucketTests::finalizeLedgerTxnChanges(
295307 }
296308
297309 // Use the testing values.
310+ auto testInitRefs = toRefs (mTestInitEntries );
311+ auto testLiveRefs = toRefs (mTestLiveEntries );
312+ auto testDeadRefs = toRefs (mTestDeadEntries );
298313 mApplyState .addAnyContractsToModuleCache (lh.ledgerVersion ,
299- mTestInitEntries );
314+ testInitRefs );
300315 mApplyState .addAnyContractsToModuleCache (lh.ledgerVersion ,
301- mTestLiveEntries );
302- mApp .getBucketManager ().addLiveBatch (
303- mApp , lh, mTestInitEntries , mTestLiveEntries , mTestDeadEntries );
316+ testLiveRefs );
317+ mApp .getBucketManager ().addLiveBatch (mApp , lh, testInitRefs,
318+ testLiveRefs, testDeadRefs );
304319
305320 // Load the final Soroban config AFTER addLiveBatch so that test
306321 // entries (e.g. stateArchivalSettings with eviction iterator) are
@@ -325,8 +340,7 @@ LedgerManagerForBucketTests::finalizeLedgerTxnChanges(
325340 }
326341
327342 mApplyState .updateInMemorySorobanState (
328- mTestInitEntries , mTestLiveEntries , mTestDeadEntries , lh,
329- finalSorobanConfig);
343+ testInitRefs, testLiveRefs, testDeadRefs, lh, finalSorobanConfig);
330344
331345 mUseTestEntries = false ;
332346 mAlsoAddActualEntries = false ;
0 commit comments