Skip to content

Commit

Permalink
stellar#5153: removed remotecaptivecoreurl config var, it's no longer…
Browse files Browse the repository at this point in the history
… referenced
  • Loading branch information
sreuland committed Jan 11, 2024
1 parent a7e2ab6 commit a781a11
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 49 deletions.
1 change: 0 additions & 1 deletion services/horizon/cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ func runDBReingestRange(ledgerRanges []history.LedgerRange, reingestForce bool,
ReingestRetryBackoffSeconds: int(retryBackoffSeconds),
CaptiveCoreBinaryPath: config.CaptiveCoreBinaryPath,
CaptiveCoreConfigUseDB: config.CaptiveCoreConfigUseDB,
RemoteCaptiveCoreURL: config.RemoteCaptiveCoreURL,
CaptiveCoreToml: config.CaptiveCoreToml,
CaptiveCoreStoragePath: config.CaptiveCoreStoragePath,
StellarCoreURL: config.StellarCoreURL,
Expand Down
3 changes: 0 additions & 3 deletions services/horizon/cmd/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ var ingestVerifyRangeCmd = &cobra.Command{
HistoryArchiveURLs: globalConfig.HistoryArchiveURLs,
CaptiveCoreBinaryPath: globalConfig.CaptiveCoreBinaryPath,
CaptiveCoreConfigUseDB: globalConfig.CaptiveCoreConfigUseDB,
RemoteCaptiveCoreURL: globalConfig.RemoteCaptiveCoreURL,
CheckpointFrequency: globalConfig.CheckpointFrequency,
CaptiveCoreToml: globalConfig.CaptiveCoreToml,
CaptiveCoreStoragePath: globalConfig.CaptiveCoreStoragePath,
Expand Down Expand Up @@ -213,7 +212,6 @@ var ingestStressTestCmd = &cobra.Command{
HistoryArchiveURLs: globalConfig.HistoryArchiveURLs,
RoundingSlippageFilter: globalConfig.RoundingSlippageFilter,
CaptiveCoreBinaryPath: globalConfig.CaptiveCoreBinaryPath,
RemoteCaptiveCoreURL: globalConfig.RemoteCaptiveCoreURL,
CaptiveCoreConfigUseDB: globalConfig.CaptiveCoreConfigUseDB,
}

Expand Down Expand Up @@ -353,7 +351,6 @@ var ingestBuildStateCmd = &cobra.Command{
HistoryArchiveURLs: globalConfig.HistoryArchiveURLs,
CaptiveCoreBinaryPath: globalConfig.CaptiveCoreBinaryPath,
CaptiveCoreConfigUseDB: globalConfig.CaptiveCoreConfigUseDB,
RemoteCaptiveCoreURL: globalConfig.RemoteCaptiveCoreURL,
CheckpointFrequency: globalConfig.CheckpointFrequency,
CaptiveCoreToml: globalConfig.CaptiveCoreToml,
CaptiveCoreStoragePath: globalConfig.CaptiveCoreStoragePath,
Expand Down
1 change: 0 additions & 1 deletion services/horizon/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type Config struct {

EnableIngestionFiltering bool
CaptiveCoreBinaryPath string
RemoteCaptiveCoreURL string
CaptiveCoreConfigPath string
CaptiveCoreTomlParams ledgerbackend.CaptiveCoreTomlParams
CaptiveCoreToml *ledgerbackend.CaptiveCoreToml
Expand Down
63 changes: 20 additions & 43 deletions services/horizon/internal/ingest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ type Config struct {
CaptiveCoreStoragePath string
CaptiveCoreToml *ledgerbackend.CaptiveCoreToml
CaptiveCoreConfigUseDB bool
RemoteCaptiveCoreURL string
NetworkPassphrase string

HistorySession db.SessionInterface
Expand All @@ -109,19 +108,6 @@ type Config struct {
MaxLedgerPerFlush uint32
}

// LocalCaptiveCoreEnabled returns true if configured to run
// a local captive core instance for ingestion.
func (c Config) LocalCaptiveCoreEnabled() bool {
// c.RemoteCaptiveCoreURL is always empty when running local captive core.
return c.RemoteCaptiveCoreURL == ""
}

// RemoteCaptiveCoreEnabled returns true if configured to run
// a remote captive core instance for ingestion.
func (c Config) RemoteCaptiveCoreEnabled() bool {
return c.RemoteCaptiveCoreURL != ""
}

const (
getLastIngestedErrMsg string = "Error getting last ingested ledger"
getIngestVersionErrMsg string = "Error getting ingestion version"
Expand Down Expand Up @@ -243,35 +229,26 @@ func NewSystem(config Config) (System, error) {
return nil, errors.Wrap(err, "error creating history archive")
}

var ledgerBackend ledgerbackend.LedgerBackend
if config.RemoteCaptiveCoreEnabled() {
ledgerBackend, err = ledgerbackend.NewRemoteCaptive(config.RemoteCaptiveCoreURL)
if err != nil {
cancel()
return nil, errors.Wrap(err, "error creating captive core backend")
}
} else {
// the only other option is local captive core config
logger := log.WithField("subservice", "stellar-core")
ledgerBackend, err = ledgerbackend.NewCaptive(
ledgerbackend.CaptiveCoreConfig{
BinaryPath: config.CaptiveCoreBinaryPath,
StoragePath: config.CaptiveCoreStoragePath,
UseDB: config.CaptiveCoreConfigUseDB,
Toml: config.CaptiveCoreToml,
NetworkPassphrase: config.NetworkPassphrase,
HistoryArchiveURLs: config.HistoryArchiveURLs,
CheckpointFrequency: config.CheckpointFrequency,
LedgerHashStore: ledgerbackend.NewHorizonDBLedgerHashStore(config.HistorySession),
Log: logger,
Context: ctx,
UserAgent: fmt.Sprintf("captivecore horizon/%s golang/%s", apkg.Version(), runtime.Version()),
},
)
if err != nil {
cancel()
return nil, errors.Wrap(err, "error creating captive core backend")
}
// the only ingest option is local captive core config
logger := log.WithField("subservice", "stellar-core")
ledgerBackend, err := ledgerbackend.NewCaptive(
ledgerbackend.CaptiveCoreConfig{
BinaryPath: config.CaptiveCoreBinaryPath,
StoragePath: config.CaptiveCoreStoragePath,
UseDB: config.CaptiveCoreConfigUseDB,
Toml: config.CaptiveCoreToml,
NetworkPassphrase: config.NetworkPassphrase,
HistoryArchiveURLs: config.HistoryArchiveURLs,
CheckpointFrequency: config.CheckpointFrequency,
LedgerHashStore: ledgerbackend.NewHorizonDBLedgerHashStore(config.HistorySession),
Log: logger,
Context: ctx,
UserAgent: fmt.Sprintf("captivecore horizon/%s golang/%s", apkg.Version(), runtime.Version()),
},
)
if err != nil {
cancel()
return nil, errors.Wrap(err, "error creating captive core backend")
}

historyQ := &history.Q{config.HistorySession.Clone()}
Expand Down
1 change: 0 additions & 1 deletion services/horizon/internal/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func initIngester(app *App) {
CaptiveCoreStoragePath: app.config.CaptiveCoreStoragePath,
CaptiveCoreConfigUseDB: app.config.CaptiveCoreConfigUseDB,
CaptiveCoreToml: app.config.CaptiveCoreToml,
RemoteCaptiveCoreURL: app.config.RemoteCaptiveCoreURL,
DisableStateVerification: app.config.IngestDisableStateVerification,
StateVerificationCheckpointFrequency: uint32(app.config.IngestStateVerificationCheckpointFrequency),
StateVerificationTimeout: app.config.IngestStateVerificationTimeout,
Expand Down

0 comments on commit a781a11

Please sign in to comment.