From 441c60cd02fd26b7a81cd1587fdc48f700d2306d Mon Sep 17 00:00:00 2001 From: George Date: Wed, 4 Sep 2024 11:28:47 -0700 Subject: [PATCH] [skip ci] Update comments accordingly --- cmd/soroban-rpc/internal/daemon/daemon.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/cmd/soroban-rpc/internal/daemon/daemon.go b/cmd/soroban-rpc/internal/daemon/daemon.go index 91d62f76..b3b633f2 100644 --- a/cmd/soroban-rpc/internal/daemon/daemon.go +++ b/cmd/soroban-rpc/internal/daemon/daemon.go @@ -342,12 +342,6 @@ func (d *Daemon) mustInitializeStorage(cfg *config.Config) *feewindow.FeeWindows d.logger.WithError(err).Fatal("could not get ledger range for migration") } - // - // 2. However, if we have already performed migrations, we don't want to - // count those in the "to migrate" ledger range. Thus, db.BuildMigrations - // will return the *applicable* range for the incomplete set of migrations. - // That means **it may be empty** if all migrations have occurred. - // dataMigrations, err := db.BuildMigrations( readTxMetaCtx, d.logger, d.db, cfg.NetworkPassphrase, retentionRange) if err != nil { @@ -355,10 +349,12 @@ func (d *Daemon) mustInitializeStorage(cfg *config.Config) *feewindow.FeeWindows } // - // 4. Finally, we can incorporate the fee analysis window. If there are - // migrations to do, this will have no effect, since the migration window is - // larger than the fee window. If there were *no* migrations, though, this - // means the final range is only the fee stat analysis range. + // 2. Then, incorporate the fee analysis window. If there are migrations to + // do, this will have no effect, since the migration window is larger than + // the fee window. If there were *no* migrations, though, this means the + // final range is only the fee stat analysis range. By treating the fee + // window as if it's a migration, we can make the interface here really + // clean. // feeStatsRange, err := db.GetMigrationLedgerRange(readTxMetaCtx, d.db, maxFeeRetentionWindow) if err != nil { @@ -369,7 +365,7 @@ func (d *Daemon) mustInitializeStorage(cfg *config.Config) *feewindow.FeeWindows ledgerSeqRange := dataMigrations.ApplicableRange() // - // 5. Apply migration for events & transactions, and perform fee stat analysis. + // 3. Apply all migrations, which includes fee stat analysis. // var initialSeq, currentSeq uint32 err = db.NewLedgerReader(d.db).StreamLedgerRange(