Skip to content

Commit

Permalink
Fix typo from stellar#237 (stellar#238)
Browse files Browse the repository at this point in the history
* Fix typo from stellar#237

I didn't adapt the logic right.

This was hard to debug because, in integration tests, it caused the
daemon to run `d.logger.WithError(err).Fatal("could not build
migrations")`, which in turn runs `os.Exit` which ends the test right
away (without flushing logs etc).

I need to think how to improve this. One option is to
override the `ExitFunc` in logrus with an assertion.

* Add verbosity again to see what's wrong

* Fix the error further

* Revert "Add verbosity again to see what's wrong"

This reverts commit 0be1cd6.
  • Loading branch information
2opremio authored Jul 8, 2024
1 parent 556d535 commit 665aa86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/db/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func newGuardedDataMigration(
return nil, err
}
latestLedger, err := NewLedgerEntryReader(db).GetLatestLedgerSequence(ctx)
if errors.Is(err, ErrEmptyDB) {
if err != nil && !errors.Is(err, ErrEmptyDB) {
err = errors.Join(err, migrationDB.Rollback())
return nil, fmt.Errorf("failed to get latest ledger sequence: %w", err)
}
Expand Down

0 comments on commit 665aa86

Please sign in to comment.