Skip to content

Commit

Permalink
[skip ci] Update comments accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Sep 4, 2024
1 parent e74a6a6 commit 441c60c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions cmd/soroban-rpc/internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,23 +342,19 @@ 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 {
d.logger.WithError(err).Fatal("could not build migrations")
}

//
// 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 {
Expand All @@ -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(
Expand Down

0 comments on commit 441c60c

Please sign in to comment.