@@ -56,6 +56,32 @@ namespace
56
56
// Limit to the maximum resource fee allowed for transaction,
57
57
// roughly 112 million lumens.
58
58
int64_t const MAX_RESOURCE_FEE = 1LL << 50 ;
59
+
60
+ // Starting in protocol 23, some operation meta needs to be modified
61
+ // to be consumed by downstream systems. In particular, restoration is
62
+ // logically a new entry creation from the perspective of ltx and stellar-core
63
+ // as a whole, but this change type is reclassified to LEDGER_ENTRY_RESTORED
64
+ // for easier consumption downstream.
65
+ void
66
+ processOpLedgerEntryChanges (std::shared_ptr<OperationFrame const > op,
67
+ LedgerEntryChanges& changes)
68
+ {
69
+ if (op->getOperation ().body .type () != RESTORE_FOOTPRINT)
70
+ {
71
+ return ;
72
+ }
73
+
74
+ for (auto & change : changes)
75
+ {
76
+ if (change.type () == LEDGER_ENTRY_CREATED)
77
+ {
78
+ auto le = change.created ();
79
+ change.type (LEDGER_ENTRY_RESTORED);
80
+ change.restored () = le;
81
+ }
82
+ }
83
+ }
84
+
59
85
} // namespace
60
86
61
87
using namespace std ;
@@ -1638,6 +1664,14 @@ TransactionFrame::applyOperations(SignatureChecker& signatureChecker,
1638
1664
// The operation meta will be empty if the transaction
1639
1665
// doesn't succeed so we may as well not do any work in that
1640
1666
// case
1667
+ auto changes = ltxOp.getChanges ();
1668
+
1669
+ if (protocolVersionStartsFrom (
1670
+ ledgerVersion,
1671
+ Bucket::FIRST_PROTOCOL_SUPPORTING_PERSISTENT_EVICTION))
1672
+ {
1673
+ processOpLedgerEntryChanges (op, changes);
1674
+ }
1641
1675
operationMetas.emplace_back (ltxOp.getChanges ());
1642
1676
}
1643
1677
0 commit comments