Skip to content

Commit

Permalink
soroban-rpc: Force On-Disk Mode by Removing --captive-core-use-db (#1091
Browse files Browse the repository at this point in the history
)

* Force captive core on-disk mode

* Remove captive_core_use_db from test configs
  • Loading branch information
stellarsaur authored Nov 21, 2023
1 parent 937f492 commit 7f8ad60
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 13 deletions.
1 change: 0 additions & 1 deletion cmd/soroban-rpc/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type Config struct {
Strict bool

StellarCoreURL string
CaptiveCoreUseDB bool
CaptiveCoreStoragePath string
StellarCoreBinaryPath string
CaptiveCoreConfigPath string
Expand Down
6 changes: 0 additions & 6 deletions cmd/soroban-rpc/internal/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,6 @@ func (cfg *Config) options() ConfigOptions {
}
},
},
{
Name: "captive-core-use-db",
Usage: "informs captive core to use on disk mode. the db will by default be created in current runtime directory of soroban-rpc, unless DATABASE=<path> setting is present in captive core config file.",
ConfigKey: &cfg.CaptiveCoreUseDB,
DefaultValue: false,
},
{
Name: "history-archive-urls",
Usage: "comma-separated list of stellar history archives to connect with",
Expand Down
1 change: 0 additions & 1 deletion cmd/soroban-rpc/internal/config/test.soroban.rpc.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ NETWORK_PASSPHRASE="Standalone Network ; February 2017"
STELLAR_CORE_URL="http://localhost:11626"
CAPTIVE_CORE_CONFIG_PATH="/opt/stellar/soroban-rpc/etc/stellar-captive-core.cfg"
CAPTIVE_CORE_STORAGE_PATH="/opt/stellar/soroban-rpc/captive-core"
CAPTIVE_CORE_USE_DB=true
STELLAR_CORE_BINARY_PATH="/usr/bin/stellar-core"
HISTORY_ARCHIVE_URLS=["http://localhost:1570"]
DB_PATH="/opt/stellar/soroban-rpc/rpc_db.sqlite"
Expand Down
2 changes: 0 additions & 2 deletions cmd/soroban-rpc/internal/config/toml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ NETWORK_PASSPHRASE = "Test SDF Future Network ; October 2022"
# testing comments work ok
STELLAR_CORE_BINARY_PATH = "/usr/bin/stellar-core"
CAPTIVE_CORE_USE_DB = true
CAPTIVE_CORE_STORAGE_PATH = "/etc/stellar/soroban-rpc"
CAPTIVE_CORE_CONFIG_PATH = "/etc/stellar/soroban-rpc/captive-core.cfg"
`
Expand All @@ -31,7 +30,6 @@ func TestBasicTomlReading(t *testing.T) {
// Check the fields got read correctly
assert.Equal(t, []string{"http://history-futurenet.stellar.org"}, cfg.HistoryArchiveURLs)
assert.Equal(t, network.FutureNetworkPassphrase, cfg.NetworkPassphrase)
assert.Equal(t, true, cfg.CaptiveCoreUseDB)
assert.Equal(t, "/etc/stellar/soroban-rpc", cfg.CaptiveCoreStoragePath)
assert.Equal(t, "/etc/stellar/soroban-rpc/captive-core.cfg", cfg.CaptiveCoreConfigPath)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/soroban-rpc/internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func newCaptiveCore(cfg *config.Config, logger *supportlog.Entry) (*ledgerbacken
HistoryArchiveURLs: cfg.HistoryArchiveURLs,
NetworkPassphrase: cfg.NetworkPassphrase,
Strict: true,
UseDB: cfg.CaptiveCoreUseDB,
UseDB: true,
EnforceSorobanDiagnosticEvents: true,
}
captiveCoreToml, err := ledgerbackend.NewCaptiveCoreTomlFromFile(cfg.CaptiveCoreConfigPath, captiveCoreTomlParams)
Expand All @@ -122,7 +122,7 @@ func newCaptiveCore(cfg *config.Config, logger *supportlog.Entry) (*ledgerbacken
Log: logger.WithField("subservice", "stellar-core"),
Toml: captiveCoreToml,
UserAgent: "captivecore",
UseDB: cfg.CaptiveCoreUseDB,
UseDB: true,
}
return ledgerbackend.NewCaptive(captiveConfig)

Expand Down
1 change: 0 additions & 1 deletion cmd/soroban-rpc/internal/test/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ func (i *Test) launchDaemon(coreBinaryPath string) {
config.CaptiveCoreConfigPath = path.Join(i.composePath, "captive-core-integration-tests.cfg")
config.CaptiveCoreStoragePath = i.t.TempDir()
config.CaptiveCoreHTTPPort = 0
config.CaptiveCoreUseDB = true
config.FriendbotURL = friendbotURL
config.NetworkPassphrase = StandaloneNetworkPassphrase
config.HistoryArchiveURLs = []string{"http://localhost:1570"}
Expand Down

0 comments on commit 7f8ad60

Please sign in to comment.