diff --git a/ingest/ledgerbackend/testdata/appendix-with-bucket-dir-path.cfg b/ingest/ledgerbackend/testdata/appendix-with-bucket-dir-path.cfg new file mode 100644 index 0000000000..9dc27bf8f6 --- /dev/null +++ b/ingest/ledgerbackend/testdata/appendix-with-bucket-dir-path.cfg @@ -0,0 +1,2 @@ +BUCKET_DIR_PATH="test-buckets" + diff --git a/ingest/ledgerbackend/testdata/appendix-with-fields.cfg b/ingest/ledgerbackend/testdata/appendix-with-fields.cfg index 42c4d2459f..3a7d641878 100644 --- a/ingest/ledgerbackend/testdata/appendix-with-fields.cfg +++ b/ingest/ledgerbackend/testdata/appendix-with-fields.cfg @@ -3,7 +3,6 @@ FAILURE_SAFETY=2 UNSAFE_QUORUM=false PUBLIC_HTTP_PORT=true RUN_STANDALONE=false -BUCKET_DIR_PATH="test-buckets" HTTP_PORT = 6789 PEER_PORT = 12345 LOG_FILE_PATH = "" @@ -64,4 +63,4 @@ VALIDATORS=[ "GAXSWUO4RBELRQT5WMDLIKTRIKC722GGXX2GIGEYQZDQDLOTINQ4DX6F J_from_above", "GAWOEMG7DQDWHCFDTPJEBYWRKUUZTX2M2HLMNABM42G7C7IAPU54GL6X K_from_above", "GDZAJNUUDJFKTZX3YWZSOAS4S4NGCJ5RQAY7JPYBG5CUFL3JZ5C3ECOH L_from_above" -] \ No newline at end of file +] diff --git a/ingest/ledgerbackend/testdata/expected-offline-with-extra-fields.cfg b/ingest/ledgerbackend/testdata/expected-offline-with-extra-fields.cfg index 5d2d74fb1a..d7b41a0b81 100644 --- a/ingest/ledgerbackend/testdata/expected-offline-with-extra-fields.cfg +++ b/ingest/ledgerbackend/testdata/expected-offline-with-extra-fields.cfg @@ -1,5 +1,4 @@ # Generated file, do not edit -BUCKET_DIR_PATH = "test-buckets" FAILURE_SAFETY = 0 HTTP_PORT = 0 LOG_FILE_PATH = "" diff --git a/ingest/ledgerbackend/toml.go b/ingest/ledgerbackend/toml.go index e5f7529a43..c6ac869a9f 100644 --- a/ingest/ledgerbackend/toml.go +++ b/ingest/ledgerbackend/toml.go @@ -326,6 +326,11 @@ func NewCaptiveCoreTomlFromFile(configPath string, params CaptiveCoreTomlParams) if err = captiveCoreToml.unmarshal(data, params.Strict); err != nil { return nil, errors.Wrap(err, "could not unmarshal captive core toml") } + // disallow setting BUCKET_DIR_PATH through a file since it can cause multiple + // running captive-core instances to clash + if params.Strict && captiveCoreToml.BucketDirPath != "" { + return nil, errors.New("could not unmarshal captive core toml: setting BUCKET_DIR_PATH is disallowed, it can cause clashes between instances") + } if err = captiveCoreToml.validate(params); err != nil { return nil, errors.Wrap(err, "invalid captive core toml") @@ -390,7 +395,7 @@ func (c *CaptiveCoreToml) CatchupToml() (*CaptiveCoreToml, error) { // Add a fictional quorum -- necessary to convince core to start up; // but not used at all for our purposes. Pubkey here is just random. offline.QuorumSetEntries = map[string]QuorumSet{ - "QUORUM_SET": QuorumSet{ + "QUORUM_SET": { ThresholdPercent: 100, Validators: []string{"GCZBOIAY4HLKAJVNJORXZOZRAY2BJDBZHKPBHZCRAIUR5IHC2UHBGCQR"}, }, diff --git a/ingest/ledgerbackend/toml_test.go b/ingest/ledgerbackend/toml_test.go index 5052c85ced..b8da4de03c 100644 --- a/ingest/ledgerbackend/toml_test.go +++ b/ingest/ledgerbackend/toml_test.go @@ -186,6 +186,11 @@ func TestCaptiveCoreTomlValidation(t *testing.T) { logPath: nil, expectedError: "could not unmarshal captive core toml: these fields are not supported by captive core: [\"CATCHUP_RECENT\"]", }, + { + name: "unexpected BUCKET_DIR_PATH", + appendPath: filepath.Join("testdata", "appendix-with-bucket-dir-path.cfg"), + expectedError: "could not unmarshal captive core toml: setting BUCKET_DIR_PATH is disallowed, it can cause clashes between instances", + }, } { t.Run(testCase.name, func(t *testing.T) { params := CaptiveCoreTomlParams{ diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index b08fc20b33..803d20737c 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -19,6 +19,7 @@ file. This project adheres to [Semantic Versioning](http://semver.org/). * Handle replica conflict errors gracefully ([3674](https://github.com/stellar/go/pull/3674)). * Fix data race in request parameters handling ([3690](https://github.com/stellar/go/pull/3690)). * Fix bug where the configuration for `CAPTIVE_CORE_LOG_PATH`, `CAPTIVE_CORE_PEER_PORT`, and `CAPTIVE_CORE_HTTP_PORT` were ignored if they were configured via environment variables instead of command line arguments. ([3702](https://github.com/stellar/go/pull/3702)). +* Error when setting `BUCKET_DIR_PATH` through `--captive-core-config-path` ([3707](https://github.com/stellar/go/pull/3707)). ## v2.4.1