@@ -552,7 +552,8 @@ closeLedgerOn(Application& app, int day, int month, int year,
552552
553553TransactionResultSet
554554closeLedger (Application& app, std::vector<TransactionFrameBasePtr> const & txs,
555- ParallelSorobanOrder const & parallelSorobanOrder)
555+ ParallelSorobanOrder const & parallelSorobanOrder,
556+ ApplyOrderTxCallback const & applyOrderTxCallback)
556557{
557558 auto lastCloseTime = app.getLedgerManager ()
558559 .getLastClosedLedgerHeader ()
@@ -561,12 +562,14 @@ closeLedger(Application& app, std::vector<TransactionFrameBasePtr> const& txs,
561562 auto nextLedgerSeq = app.getLedgerManager ().getLastClosedLedgerNum () + 1 ;
562563
563564 return closeLedgerOn (app, nextLedgerSeq, lastCloseTime, txs, true ,
564- emptyUpgradeSteps, parallelSorobanOrder);
565+ emptyUpgradeSteps, parallelSorobanOrder,
566+ applyOrderTxCallback);
565567}
566568
567569TransactionResultSet
568570closeLedger (Application& app, std::vector<TransactionFrameBasePtr> const & txs,
569- bool strictOrder, xdr::xvector<UpgradeType, 6 > const & upgrades)
571+ bool strictOrder, xdr::xvector<UpgradeType, 6 > const & upgrades,
572+ ApplyOrderTxCallback const & applyOrderTxCallback)
570573{
571574 auto lastCloseTime = app.getLedgerManager ()
572575 .getLastClosedLedgerHeader ()
@@ -575,14 +578,15 @@ closeLedger(Application& app, std::vector<TransactionFrameBasePtr> const& txs,
575578 auto nextLedgerSeq = app.getLedgerManager ().getLastClosedLedgerNum () + 1 ;
576579
577580 return closeLedgerOn (app, nextLedgerSeq, lastCloseTime, txs, strictOrder,
578- upgrades);
581+ upgrades, {}, applyOrderTxCallback );
579582}
580583
581584TransactionResultSet
582585closeLedgerOn (Application& app, uint32 ledgerSeq, TimePoint closeTime,
583586 std::vector<TransactionFrameBasePtr> const & txs, bool strictOrder,
584587 xdr::xvector<UpgradeType, 6 > const & upgrades,
585- ParallelSorobanOrder const & parallelSorobanOrder)
588+ ParallelSorobanOrder const & parallelSorobanOrder,
589+ ApplyOrderTxCallback const & applyOrderTxCallback)
586590{
587591 // Ensure that parallelSorobanOrder is only used with strictOrder
588592 releaseAssert ((parallelSorobanOrder.empty () || strictOrder));
@@ -636,6 +640,18 @@ closeLedgerOn(Application& app, uint32 ledgerSeq, TimePoint closeTime,
636640 // themselves maybe intentionally invalid for testing purpose.
637641 releaseAssert (txSet.second ->checkValid (app, 0 , 0 ));
638642 }
643+ if (applyOrderTxCallback)
644+ {
645+ size_t txIndex = 0 ;
646+ for (auto const & phase : txSet.second ->getPhasesInApplyOrder ())
647+ {
648+ for (auto const & tx : phase)
649+ {
650+ applyOrderTxCallback (txIndex, tx);
651+ ++txIndex;
652+ }
653+ }
654+ }
639655 app.getHerder ().externalizeValue (txSet.first , ledgerSeq, closeTime,
640656 upgrades);
641657 while (app.getLedgerManager ().getLastClosedLedgerNum () < ledgerSeq)
0 commit comments