From 3b3bf8c12660455922877ae0efacf62b7c6bafbc Mon Sep 17 00:00:00 2001 From: Karthik Iyer Date: Sat, 7 Dec 2024 15:02:55 -0800 Subject: [PATCH] Helper functions for xdr.LedgerCloseMeta --- xdr/ledger_close_meta.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xdr/ledger_close_meta.go b/xdr/ledger_close_meta.go index 30e80b2e38..9624c8d3ba 100644 --- a/xdr/ledger_close_meta.go +++ b/xdr/ledger_close_meta.go @@ -131,6 +131,20 @@ func (l LedgerCloseMeta) UpgradesProcessing() []UpgradeEntryMeta { } } +func (l LedgerCloseMeta) HasUpgradeChanges() bool { + return len(l.UpgradesProcessing()) != 0 +} + +func (l LedgerCloseMeta) IsFirstLedgerAfterProtocolUpgrade() bool { + upgradeMeta := l.UpgradesProcessing() + for _, upgrade := range upgradeMeta { + if upgrade.Upgrade.Type == LedgerUpgradeTypeLedgerUpgradeVersion { + return true + } + } + return false +} + // EvictedTemporaryLedgerKeys returns a slice of ledger keys for // temporary ledger entries that have been evicted in this ledger. func (l LedgerCloseMeta) EvictedTemporaryLedgerKeys() ([]LedgerKey, error) {