From d71d9768e881da42425eb38a450f5d52be3faa27 Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Mon, 26 Jul 2021 21:10:49 +0200 Subject: [PATCH 1/5] services/horizon: Allow starting Horizon with minimal configuration --- ingest/ledgerbackend/toml.go | 49 ++++++++++++++++++++++++++++++ services/horizon/CHANGELOG.md | 1 + services/horizon/internal/flags.go | 12 ++++++-- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/ingest/ledgerbackend/toml.go b/ingest/ledgerbackend/toml.go index c6ac869a9f..2e0b01141b 100644 --- a/ingest/ledgerbackend/toml.go +++ b/ingest/ledgerbackend/toml.go @@ -7,6 +7,7 @@ import ( "regexp" "strings" + "github.com/stellar/go/network" "github.com/stellar/go/support/errors" "github.com/stellar/go/support/log" "github.com/stellar/go/xdr" @@ -348,6 +349,54 @@ func NewCaptiveCoreTomlFromFile(configPath string, params CaptiveCoreTomlParams) return &captiveCoreToml, nil } +// NewDefaultTestnetCaptiveCoreToml constructs a new CaptiveCoreToml instance +// based off the default testnet configuration. +func NewDefaultTestnetCaptiveCoreToml() *CaptiveCoreToml { + var captiveCoreToml CaptiveCoreToml + + captiveCoreToml.tablePlaceholders = &placeholders{} + + captiveCoreToml.PublicHTTPPort = true + captiveCoreToml.HTTPPort = 11626 + + captiveCoreToml.FailureSafety = -1 + captiveCoreToml.NetworkPassphrase = network.TestNetworkPassphrase + + captiveCoreToml.HomeDomains = append( + captiveCoreToml.HomeDomains, + HomeDomain{ + HomeDomain: "testnet.stellar.org", + Quality: "LOW", + }) + + captiveCoreToml.Validators = append( + captiveCoreToml.Validators, + Validator{ + Name: "sdf_testnet_1", + HomeDomain: "testnet.stellar.org", + PublicKey: "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y", + Address: "core-testnet1.stellar.org", + History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_001/{0} -o {1}", + }, + Validator{ + Name: "sdf_testnet_2", + HomeDomain: "testnet.stellar.org", + PublicKey: "GCUCJTIYXSOXKBSNFGNFWW5MUQ54HKRPGJUTQFJ5RQXZXNOLNXYDHRAP", + Address: "core-testnet2.stellar.org", + History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_002/{0} -o {1}", + }, + Validator{ + Name: "sdf_testnet_3", + HomeDomain: "testnet.stellar.org", + PublicKey: "GC2V2EFSXN6SQTWVYA5EPJPBWWIMSD2XQNKUOHGEKB535AQE2I6IXV2Z", + Address: "core-testnet3.stellar.org", + History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_003/{0} -o {1}", + }, + ) + + return &captiveCoreToml +} + // NewCaptiveCoreToml constructs a new CaptiveCoreToml instance based off // the configuration in `params`. func NewCaptiveCoreToml(params CaptiveCoreTomlParams) (*CaptiveCoreToml, error) { diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index 407f4e64dc..f5bcf3b1f2 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -5,6 +5,7 @@ file. This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +* The `--ingest` flag is set by default. * Add a feature flag `--captive-core-reuse-storage-path`/`CAPTIVE_CORE_REUSE_STORAGE_PATH` that will reuse Captive Core's storage path for bucket files when applicable for better performance ([3750](https://github.com/stellar/go/pull/3750)). ## v2.6.1 diff --git a/services/horizon/internal/flags.go b/services/horizon/internal/flags.go index d19e7a1f97..a4fd61eb6f 100644 --- a/services/horizon/internal/flags.go +++ b/services/horizon/internal/flags.go @@ -389,7 +389,7 @@ func Flags() (*Config, support.ConfigOptions) { Name: "ingest", ConfigKey: &config.Ingest, OptType: types.Bool, - FlagDefault: false, + FlagDefault: true, Usage: "causes this horizon process to ingest data from stellar-core into horizon's db", }, &support.ConfigOption{ @@ -538,8 +538,14 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption if config.RemoteCaptiveCoreURL == "" && (binaryPath == "" || config.CaptiveCoreConfigPath == "") { if options.RequireCaptiveCoreConfig { - stdLog.Fatalf("Invalid config: captive core requires that both --%s and --%s are set. %s", - StellarCoreBinaryPathName, CaptiveCoreConfigPathName, captiveCoreMigrationHint) + switch config.NetworkPassphrase { + case "Test SDF Network ; September 2015": + config.CaptiveCoreToml = ledgerbackend.NewDefaultTestnetCaptiveCoreToml() + config.HistoryArchiveURLs = []string{"https://history.stellar.org/prd/core-testnet/core_testnet_001/"} + default: + stdLog.Fatalf("Invalid config: captive core requires that both --%s and --%s are set. %s", + StellarCoreBinaryPathName, CaptiveCoreConfigPathName, captiveCoreMigrationHint) + } } else { var err error config.CaptiveCoreTomlParams.HistoryArchiveURLs = config.HistoryArchiveURLs From 246ddbdfabe774fc84dfe79f237d58db61a55598 Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Tue, 27 Jul 2021 18:13:09 +0200 Subject: [PATCH 2/5] pubnet --- ingest/ledgerbackend/toml.go | 230 ++++++++++++++++++++++++++-- services/horizon/CHANGELOG.md | 2 +- services/horizon/internal/app.go | 15 ++ services/horizon/internal/config.go | 1 + services/horizon/internal/flags.go | 7 +- 5 files changed, 243 insertions(+), 12 deletions(-) diff --git a/ingest/ledgerbackend/toml.go b/ingest/ledgerbackend/toml.go index 2e0b01141b..3a530ab644 100644 --- a/ingest/ledgerbackend/toml.go +++ b/ingest/ledgerbackend/toml.go @@ -362,37 +362,247 @@ func NewDefaultTestnetCaptiveCoreToml() *CaptiveCoreToml { captiveCoreToml.FailureSafety = -1 captiveCoreToml.NetworkPassphrase = network.TestNetworkPassphrase - captiveCoreToml.HomeDomains = append( - captiveCoreToml.HomeDomains, - HomeDomain{ + captiveCoreToml.HomeDomains = []HomeDomain{ + { HomeDomain: "testnet.stellar.org", Quality: "LOW", - }) + }, + } - captiveCoreToml.Validators = append( - captiveCoreToml.Validators, - Validator{ + captiveCoreToml.Validators = []Validator{ + { Name: "sdf_testnet_1", HomeDomain: "testnet.stellar.org", PublicKey: "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y", Address: "core-testnet1.stellar.org", History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_001/{0} -o {1}", }, - Validator{ + { Name: "sdf_testnet_2", HomeDomain: "testnet.stellar.org", PublicKey: "GCUCJTIYXSOXKBSNFGNFWW5MUQ54HKRPGJUTQFJ5RQXZXNOLNXYDHRAP", Address: "core-testnet2.stellar.org", History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_002/{0} -o {1}", }, - Validator{ + { Name: "sdf_testnet_3", HomeDomain: "testnet.stellar.org", PublicKey: "GC2V2EFSXN6SQTWVYA5EPJPBWWIMSD2XQNKUOHGEKB535AQE2I6IXV2Z", Address: "core-testnet3.stellar.org", History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_003/{0} -o {1}", }, - ) + } + + return &captiveCoreToml +} + +// NewDefaultPubnetCaptiveCoreToml constructs a new CaptiveCoreToml instance +// based off the default pubnet configuration. +func NewDefaultPubnetCaptiveCoreToml() *CaptiveCoreToml { + var captiveCoreToml CaptiveCoreToml + + captiveCoreToml.tablePlaceholders = &placeholders{} + + captiveCoreToml.PublicHTTPPort = true + captiveCoreToml.HTTPPort = 11626 + + captiveCoreToml.FailureSafety = -1 + captiveCoreToml.NetworkPassphrase = network.PublicNetworkPassphrase + + captiveCoreToml.HomeDomains = []HomeDomain{ + { + HomeDomain: "stellar.org", + Quality: "HIGH", + }, + { + HomeDomain: "satoshipay.io", + Quality: "HIGH", + }, + { + HomeDomain: "lobstr.co", + Quality: "HIGH", + }, + { + HomeDomain: "www.coinqvest.com", + Quality: "HIGH", + }, + { + HomeDomain: "keybase.io", + Quality: "HIGH", + }, + { + HomeDomain: "stellar.blockdaemon.com", + Quality: "HIGH", + }, + { + HomeDomain: "wirexapp.com", + Quality: "HIGH", + }, + } + + captiveCoreToml.Validators = []Validator{ + { + Name: "sdf_1", + HomeDomain: "stellar.org", + PublicKey: "GCGB2S2KGYARPVIA37HYZXVRM2YZUEXA6S33ZU5BUDC6THSB62LZSTYH", + Address: "core-live-a.stellar.org:11625", + History: "curl -sf https://history.stellar.org/prd/core-live/core_live_001/{0} -o {1}", + }, + { + Name: "sdf_2", + HomeDomain: "stellar.org", + PublicKey: "GCM6QMP3DLRPTAZW2UZPCPX2LF3SXWXKPMP3GKFZBDSF3QZGV2G5QSTK", + Address: "core-live-b.stellar.org:11625", + History: "curl -sf https://history.stellar.org/prd/core-live/core_live_002/{0} -o {1}", + }, + { + Name: "sdf_3", + HomeDomain: "stellar.org", + PublicKey: "GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ", + Address: "core-live-c.stellar.org:11625", + History: "curl -sf https://history.stellar.org/prd/core-live/core_live_003/{0} -o {1}", + }, + { + Name: "satoshipay_singapore", + HomeDomain: "satoshipay.io", + PublicKey: "GBJQUIXUO4XSNPAUT6ODLZUJRV2NPXYASKUBY4G5MYP3M47PCVI55MNT", + Address: "stellar-sg-sin.satoshipay.io:11625", + History: "curl -sf https://stellar-history-sg-sin.satoshipay.io/{0} -o {1}", + }, + { + Name: "satoshipay_iowa", + HomeDomain: "satoshipay.io", + PublicKey: "GAK6Z5UVGUVSEK6PEOCAYJISTT5EJBB34PN3NOLEQG2SUKXRVV2F6HZY", + Address: "stellar-us-iowa.satoshipay.io:11625", + History: "curl -sf https://stellar-history-us-iowa.satoshipay.io/{0} -o {1}", + }, + { + Name: "satoshipay_frankfurt", + HomeDomain: "satoshipay.io", + PublicKey: "GC5SXLNAM3C4NMGK2PXK4R34B5GNZ47FYQ24ZIBFDFOCU6D4KBN4POAE", + Address: "stellar-de-fra.satoshipay.io:11625", + History: "curl -sf https://stellar-history-de-fra.satoshipay.io/{0} -o {1}", + }, + { + Name: "lobstr_1_europe", + HomeDomain: "lobstr.co", + PublicKey: "GCFONE23AB7Y6C5YZOMKUKGETPIAJA4QOYLS5VNS4JHBGKRZCPYHDLW7", + Address: "v1.stellar.lobstr.co:11625", + History: "curl -sf https://stellar-archive-1-lobstr.s3.amazonaws.com/{0} -o {1}", + }, + { + Name: "lobstr_2_europe", + HomeDomain: "lobstr.co", + PublicKey: "GDXQB3OMMQ6MGG43PWFBZWBFKBBDUZIVSUDAZZTRAWQZKES2CDSE5HKJ", + Address: "v2.stellar.lobstr.co:11625", + History: "curl -sf https://stellar-archive-2-lobstr.s3.amazonaws.com/{0} -o {1}", + }, + { + Name: "lobstr_3_north_america", + HomeDomain: "lobstr.co", + PublicKey: "GD5QWEVV4GZZTQP46BRXV5CUMMMLP4JTGFD7FWYJJWRL54CELY6JGQ63", + Address: "v3.stellar.lobstr.co:11625", + History: "curl -sf https://stellar-archive-3-lobstr.s3.amazonaws.com/{0} -o {1}", + }, + { + Name: "lobstr_4_asia", + HomeDomain: "lobstr.co", + PublicKey: "GA7TEPCBDQKI7JQLQ34ZURRMK44DVYCIGVXQQWNSWAEQR6KB4FMCBT7J", + Address: "v4.stellar.lobstr.co:11625", + History: "curl -sf https://stellar-archive-4-lobstr.s3.amazonaws.com/{0} -o {1}", + }, + { + Name: "lobstr_5_australia", + HomeDomain: "lobstr.co", + PublicKey: "GA5STBMV6QDXFDGD62MEHLLHZTPDI77U3PFOD2SELU5RJDHQWBR5NNK7", + Address: "v5.stellar.lobstr.co:11625", + History: "curl -sf https://stellar-archive-5-lobstr.s3.amazonaws.com/{0} -o {1}", + }, + { + Name: "coinqvest_hong_kong", + HomeDomain: "www.coinqvest.com", + PublicKey: "GAZ437J46SCFPZEDLVGDMKZPLFO77XJ4QVAURSJVRZK2T5S7XUFHXI2Z", + Address: "hongkong.stellar.coinqvest.com:11625", + History: "curl -sf https://hongkong.stellar.coinqvest.com/history/{0} -o {1}", + }, + { + Name: "coinqvest_germany", + HomeDomain: "www.coinqvest.com", + PublicKey: "GD6SZQV3WEJUH352NTVLKEV2JM2RH266VPEM7EH5QLLI7ZZAALMLNUVN", + Address: "germany.stellar.coinqvest.com:11625", + History: "curl -sf https://germany.stellar.coinqvest.com/history/{0} -o {1}", + }, + { + Name: "coinqvest_finland", + HomeDomain: "www.coinqvest.com", + PublicKey: "GADLA6BJK6VK33EM2IDQM37L5KGVCY5MSHSHVJA4SCNGNUIEOTCR6J5T", + Address: "finland.stellar.coinqvest.com:11625", + History: "curl -sf https://finland.stellar.coinqvest.com/history/{0} -o {1}", + }, + { + Name: "keybase_io", + HomeDomain: "keybase.io", + PublicKey: "GCWJKM4EGTGJUVSWUJDPCQEOEP5LHSOFKSA4HALBTOO4T4H3HCHOM6UX", + Address: "stellar0.keybase.io:11625", + History: "curl -sf https://stellarhistory.keybase.io/{0} -o {1}", + }, + { + Name: "keybase_1", + HomeDomain: "keybase.io", + PublicKey: "GDKWELGJURRKXECG3HHFHXMRX64YWQPUHKCVRESOX3E5PM6DM4YXLZJM", + Address: "stellar1.keybase.io:11625", + History: "curl -sf https://stellarhistory1.keybase.io/{0} -o {1}", + }, + { + Name: "keybase_2", + HomeDomain: "keybase.io", + PublicKey: "GA35T3723UP2XJLC2H7MNL6VMKZZIFL2VW7XHMFFJKKIA2FJCYTLKFBW", + Address: "stellar2.keybase.io:11625", + History: "curl -sf https://stellarhistory2.keybase.io/{0} -o {1}", + }, + { + Name: "Blockdaemon_Validator_1", + HomeDomain: "stellar.blockdaemon.com", + PublicKey: "GAAV2GCVFLNN522ORUYFV33E76VPC22E72S75AQ6MBR5V45Z5DWVPWEU", + Address: "stellar-full-validator1.bdnodes.net", + History: "curl -sf https://stellar-full-history1.bdnodes.net/{0} -o {1}", + }, + { + Name: "Blockdaemon_Validator_2", + HomeDomain: "stellar.blockdaemon.com", + PublicKey: "GAVXB7SBJRYHSG6KSQHY74N7JAFRL4PFVZCNWW2ARI6ZEKNBJSMSKW7C", + Address: "stellar-full-validator2.bdnodes.net", + History: "curl -sf https://stellar-full-history2.bdnodes.net/{0} -o {1}", + }, + { + Name: "Blockdaemon_Validator_3", + HomeDomain: "stellar.blockdaemon.com", + PublicKey: "GAYXZ4PZ7P6QOX7EBHPIZXNWY4KCOBYWJCA4WKWRKC7XIUS3UJPT6EZ4", + Address: "stellar-full-validator3.bdnodes.net", + History: "curl -sf https://stellar-full-history3.bdnodes.net/{0} -o {1}", + }, + { + Name: "wirexUS", + HomeDomain: "wirexapp.com", + PublicKey: "GDXUKFGG76WJC7ACEH3JUPLKM5N5S76QSMNDBONREUXPCZYVPOLFWXUS", + Address: "us.stellar.wirexapp.com", + History: "curl -sf http://wxhorizonusstga1.blob.core.windows.net/history/{0} -o {1}", + }, + { + Name: "wirexUK", + HomeDomain: "wirexapp.com", + PublicKey: "GBBQQT3EIUSXRJC6TGUCGVA3FVPXVZLGG3OJYACWBEWYBHU46WJLWXEU", + Address: "uk.stellar.wirexapp.com", + History: "curl -sf http://wxhorizonukstga1.blob.core.windows.net/history/{0} -o {1}", + }, + { + Name: "wirexSG", + HomeDomain: "wirexapp.com", + PublicKey: "GAB3GZIE6XAYWXGZUDM4GMFFLJBFMLE2JDPUCWUZXMOMT3NHXDHEWXAS", + Address: "sg.stellar.wirexapp.com", + History: "curl -sf http://wxhorizonasiastga1.blob.core.windows.net/history/{0} -o {1}", + }, + } return &captiveCoreToml } diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index f5bcf3b1f2..53cc8ab211 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -5,7 +5,7 @@ file. This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased -* The `--ingest` flag is set by default. +* The `--ingest` flag is set by default. If `--captive-core-config-path` is not set, the config file is generated based on network passhprase. ([3783](https://github.com/stellar/go/pull/3783)) * Add a feature flag `--captive-core-reuse-storage-path`/`CAPTIVE_CORE_REUSE_STORAGE_PATH` that will reuse Captive Core's storage path for bucket files when applicable for better performance ([3750](https://github.com/stellar/go/pull/3750)). ## v2.6.1 diff --git a/services/horizon/internal/app.go b/services/horizon/internal/app.go index b46cbfecd5..bdb611bdf1 100644 --- a/services/horizon/internal/app.go +++ b/services/horizon/internal/app.go @@ -119,6 +119,21 @@ func (a *App) Serve() { // configure shutdown signal handler signalChan := make(chan os.Signal, 1) signal.Notify(signalChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) + + if a.config.UsingDefaultPubnetConfig { + // If Horizon was started using default pubnet configuration kill it + // after one hour with error message. + const errorMsg = "Horizon started using the default pubnet configuration. " + + "Because this is not safe it will be shut down after one hour. " + + "Please provide a custom --captive-core-config-path." + log.Error(errorMsg) + go func() { + time.Sleep(time.Hour) + log.Error(errorMsg) + signalChan <- syscall.SIGINT + }() + } + go func() { select { case <-signalChan: diff --git a/services/horizon/internal/config.go b/services/horizon/internal/config.go index c107413e31..aadd41408b 100644 --- a/services/horizon/internal/config.go +++ b/services/horizon/internal/config.go @@ -20,6 +20,7 @@ type Config struct { AdminPort uint EnableCaptiveCoreIngestion bool + UsingDefaultPubnetConfig bool CaptiveCoreBinaryPath string RemoteCaptiveCoreURL string CaptiveCoreConfigPath string diff --git a/services/horizon/internal/flags.go b/services/horizon/internal/flags.go index a4fd61eb6f..d9a4ec2f73 100644 --- a/services/horizon/internal/flags.go +++ b/services/horizon/internal/flags.go @@ -12,6 +12,7 @@ import ( "github.com/spf13/viper" "github.com/stellar/go/ingest/ledgerbackend" + "github.com/stellar/go/network" "github.com/stellar/go/services/horizon/internal/db2/schema" apkg "github.com/stellar/go/support/app" support "github.com/stellar/go/support/config" @@ -539,9 +540,13 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption if config.RemoteCaptiveCoreURL == "" && (binaryPath == "" || config.CaptiveCoreConfigPath == "") { if options.RequireCaptiveCoreConfig { switch config.NetworkPassphrase { - case "Test SDF Network ; September 2015": + case network.TestNetworkPassphrase: config.CaptiveCoreToml = ledgerbackend.NewDefaultTestnetCaptiveCoreToml() config.HistoryArchiveURLs = []string{"https://history.stellar.org/prd/core-testnet/core_testnet_001/"} + case network.PublicNetworkPassphrase: + config.CaptiveCoreToml = ledgerbackend.NewDefaultPubnetCaptiveCoreToml() + config.HistoryArchiveURLs = []string{"https://history.stellar.org/prd/core-live/core_live_001/"} + config.UsingDefaultPubnetConfig = true default: stdLog.Fatalf("Invalid config: captive core requires that both --%s and --%s are set. %s", StellarCoreBinaryPathName, CaptiveCoreConfigPathName, captiveCoreMigrationHint) From 8b85c497aa5f837b46d4b060f53463ba91a8663d Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Fri, 30 Jul 2021 15:07:17 +0200 Subject: [PATCH 3/5] Review feedback --- ingest/ledgerbackend/toml.go | 259 ------------------ .../horizon/configs/captive-core-pubnet.cfg | 193 +++++++++++++ .../horizon/configs/captive-core-testnet.cfg | 28 ++ services/horizon/internal/app.go | 20 +- services/horizon/internal/flags.go | 28 +- .../scripts/build_release_artifacts/main.go | 5 + 6 files changed, 261 insertions(+), 272 deletions(-) create mode 100644 services/horizon/configs/captive-core-pubnet.cfg create mode 100644 services/horizon/configs/captive-core-testnet.cfg diff --git a/ingest/ledgerbackend/toml.go b/ingest/ledgerbackend/toml.go index 3a530ab644..c6ac869a9f 100644 --- a/ingest/ledgerbackend/toml.go +++ b/ingest/ledgerbackend/toml.go @@ -7,7 +7,6 @@ import ( "regexp" "strings" - "github.com/stellar/go/network" "github.com/stellar/go/support/errors" "github.com/stellar/go/support/log" "github.com/stellar/go/xdr" @@ -349,264 +348,6 @@ func NewCaptiveCoreTomlFromFile(configPath string, params CaptiveCoreTomlParams) return &captiveCoreToml, nil } -// NewDefaultTestnetCaptiveCoreToml constructs a new CaptiveCoreToml instance -// based off the default testnet configuration. -func NewDefaultTestnetCaptiveCoreToml() *CaptiveCoreToml { - var captiveCoreToml CaptiveCoreToml - - captiveCoreToml.tablePlaceholders = &placeholders{} - - captiveCoreToml.PublicHTTPPort = true - captiveCoreToml.HTTPPort = 11626 - - captiveCoreToml.FailureSafety = -1 - captiveCoreToml.NetworkPassphrase = network.TestNetworkPassphrase - - captiveCoreToml.HomeDomains = []HomeDomain{ - { - HomeDomain: "testnet.stellar.org", - Quality: "LOW", - }, - } - - captiveCoreToml.Validators = []Validator{ - { - Name: "sdf_testnet_1", - HomeDomain: "testnet.stellar.org", - PublicKey: "GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y", - Address: "core-testnet1.stellar.org", - History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_001/{0} -o {1}", - }, - { - Name: "sdf_testnet_2", - HomeDomain: "testnet.stellar.org", - PublicKey: "GCUCJTIYXSOXKBSNFGNFWW5MUQ54HKRPGJUTQFJ5RQXZXNOLNXYDHRAP", - Address: "core-testnet2.stellar.org", - History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_002/{0} -o {1}", - }, - { - Name: "sdf_testnet_3", - HomeDomain: "testnet.stellar.org", - PublicKey: "GC2V2EFSXN6SQTWVYA5EPJPBWWIMSD2XQNKUOHGEKB535AQE2I6IXV2Z", - Address: "core-testnet3.stellar.org", - History: "curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_003/{0} -o {1}", - }, - } - - return &captiveCoreToml -} - -// NewDefaultPubnetCaptiveCoreToml constructs a new CaptiveCoreToml instance -// based off the default pubnet configuration. -func NewDefaultPubnetCaptiveCoreToml() *CaptiveCoreToml { - var captiveCoreToml CaptiveCoreToml - - captiveCoreToml.tablePlaceholders = &placeholders{} - - captiveCoreToml.PublicHTTPPort = true - captiveCoreToml.HTTPPort = 11626 - - captiveCoreToml.FailureSafety = -1 - captiveCoreToml.NetworkPassphrase = network.PublicNetworkPassphrase - - captiveCoreToml.HomeDomains = []HomeDomain{ - { - HomeDomain: "stellar.org", - Quality: "HIGH", - }, - { - HomeDomain: "satoshipay.io", - Quality: "HIGH", - }, - { - HomeDomain: "lobstr.co", - Quality: "HIGH", - }, - { - HomeDomain: "www.coinqvest.com", - Quality: "HIGH", - }, - { - HomeDomain: "keybase.io", - Quality: "HIGH", - }, - { - HomeDomain: "stellar.blockdaemon.com", - Quality: "HIGH", - }, - { - HomeDomain: "wirexapp.com", - Quality: "HIGH", - }, - } - - captiveCoreToml.Validators = []Validator{ - { - Name: "sdf_1", - HomeDomain: "stellar.org", - PublicKey: "GCGB2S2KGYARPVIA37HYZXVRM2YZUEXA6S33ZU5BUDC6THSB62LZSTYH", - Address: "core-live-a.stellar.org:11625", - History: "curl -sf https://history.stellar.org/prd/core-live/core_live_001/{0} -o {1}", - }, - { - Name: "sdf_2", - HomeDomain: "stellar.org", - PublicKey: "GCM6QMP3DLRPTAZW2UZPCPX2LF3SXWXKPMP3GKFZBDSF3QZGV2G5QSTK", - Address: "core-live-b.stellar.org:11625", - History: "curl -sf https://history.stellar.org/prd/core-live/core_live_002/{0} -o {1}", - }, - { - Name: "sdf_3", - HomeDomain: "stellar.org", - PublicKey: "GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ", - Address: "core-live-c.stellar.org:11625", - History: "curl -sf https://history.stellar.org/prd/core-live/core_live_003/{0} -o {1}", - }, - { - Name: "satoshipay_singapore", - HomeDomain: "satoshipay.io", - PublicKey: "GBJQUIXUO4XSNPAUT6ODLZUJRV2NPXYASKUBY4G5MYP3M47PCVI55MNT", - Address: "stellar-sg-sin.satoshipay.io:11625", - History: "curl -sf https://stellar-history-sg-sin.satoshipay.io/{0} -o {1}", - }, - { - Name: "satoshipay_iowa", - HomeDomain: "satoshipay.io", - PublicKey: "GAK6Z5UVGUVSEK6PEOCAYJISTT5EJBB34PN3NOLEQG2SUKXRVV2F6HZY", - Address: "stellar-us-iowa.satoshipay.io:11625", - History: "curl -sf https://stellar-history-us-iowa.satoshipay.io/{0} -o {1}", - }, - { - Name: "satoshipay_frankfurt", - HomeDomain: "satoshipay.io", - PublicKey: "GC5SXLNAM3C4NMGK2PXK4R34B5GNZ47FYQ24ZIBFDFOCU6D4KBN4POAE", - Address: "stellar-de-fra.satoshipay.io:11625", - History: "curl -sf https://stellar-history-de-fra.satoshipay.io/{0} -o {1}", - }, - { - Name: "lobstr_1_europe", - HomeDomain: "lobstr.co", - PublicKey: "GCFONE23AB7Y6C5YZOMKUKGETPIAJA4QOYLS5VNS4JHBGKRZCPYHDLW7", - Address: "v1.stellar.lobstr.co:11625", - History: "curl -sf https://stellar-archive-1-lobstr.s3.amazonaws.com/{0} -o {1}", - }, - { - Name: "lobstr_2_europe", - HomeDomain: "lobstr.co", - PublicKey: "GDXQB3OMMQ6MGG43PWFBZWBFKBBDUZIVSUDAZZTRAWQZKES2CDSE5HKJ", - Address: "v2.stellar.lobstr.co:11625", - History: "curl -sf https://stellar-archive-2-lobstr.s3.amazonaws.com/{0} -o {1}", - }, - { - Name: "lobstr_3_north_america", - HomeDomain: "lobstr.co", - PublicKey: "GD5QWEVV4GZZTQP46BRXV5CUMMMLP4JTGFD7FWYJJWRL54CELY6JGQ63", - Address: "v3.stellar.lobstr.co:11625", - History: "curl -sf https://stellar-archive-3-lobstr.s3.amazonaws.com/{0} -o {1}", - }, - { - Name: "lobstr_4_asia", - HomeDomain: "lobstr.co", - PublicKey: "GA7TEPCBDQKI7JQLQ34ZURRMK44DVYCIGVXQQWNSWAEQR6KB4FMCBT7J", - Address: "v4.stellar.lobstr.co:11625", - History: "curl -sf https://stellar-archive-4-lobstr.s3.amazonaws.com/{0} -o {1}", - }, - { - Name: "lobstr_5_australia", - HomeDomain: "lobstr.co", - PublicKey: "GA5STBMV6QDXFDGD62MEHLLHZTPDI77U3PFOD2SELU5RJDHQWBR5NNK7", - Address: "v5.stellar.lobstr.co:11625", - History: "curl -sf https://stellar-archive-5-lobstr.s3.amazonaws.com/{0} -o {1}", - }, - { - Name: "coinqvest_hong_kong", - HomeDomain: "www.coinqvest.com", - PublicKey: "GAZ437J46SCFPZEDLVGDMKZPLFO77XJ4QVAURSJVRZK2T5S7XUFHXI2Z", - Address: "hongkong.stellar.coinqvest.com:11625", - History: "curl -sf https://hongkong.stellar.coinqvest.com/history/{0} -o {1}", - }, - { - Name: "coinqvest_germany", - HomeDomain: "www.coinqvest.com", - PublicKey: "GD6SZQV3WEJUH352NTVLKEV2JM2RH266VPEM7EH5QLLI7ZZAALMLNUVN", - Address: "germany.stellar.coinqvest.com:11625", - History: "curl -sf https://germany.stellar.coinqvest.com/history/{0} -o {1}", - }, - { - Name: "coinqvest_finland", - HomeDomain: "www.coinqvest.com", - PublicKey: "GADLA6BJK6VK33EM2IDQM37L5KGVCY5MSHSHVJA4SCNGNUIEOTCR6J5T", - Address: "finland.stellar.coinqvest.com:11625", - History: "curl -sf https://finland.stellar.coinqvest.com/history/{0} -o {1}", - }, - { - Name: "keybase_io", - HomeDomain: "keybase.io", - PublicKey: "GCWJKM4EGTGJUVSWUJDPCQEOEP5LHSOFKSA4HALBTOO4T4H3HCHOM6UX", - Address: "stellar0.keybase.io:11625", - History: "curl -sf https://stellarhistory.keybase.io/{0} -o {1}", - }, - { - Name: "keybase_1", - HomeDomain: "keybase.io", - PublicKey: "GDKWELGJURRKXECG3HHFHXMRX64YWQPUHKCVRESOX3E5PM6DM4YXLZJM", - Address: "stellar1.keybase.io:11625", - History: "curl -sf https://stellarhistory1.keybase.io/{0} -o {1}", - }, - { - Name: "keybase_2", - HomeDomain: "keybase.io", - PublicKey: "GA35T3723UP2XJLC2H7MNL6VMKZZIFL2VW7XHMFFJKKIA2FJCYTLKFBW", - Address: "stellar2.keybase.io:11625", - History: "curl -sf https://stellarhistory2.keybase.io/{0} -o {1}", - }, - { - Name: "Blockdaemon_Validator_1", - HomeDomain: "stellar.blockdaemon.com", - PublicKey: "GAAV2GCVFLNN522ORUYFV33E76VPC22E72S75AQ6MBR5V45Z5DWVPWEU", - Address: "stellar-full-validator1.bdnodes.net", - History: "curl -sf https://stellar-full-history1.bdnodes.net/{0} -o {1}", - }, - { - Name: "Blockdaemon_Validator_2", - HomeDomain: "stellar.blockdaemon.com", - PublicKey: "GAVXB7SBJRYHSG6KSQHY74N7JAFRL4PFVZCNWW2ARI6ZEKNBJSMSKW7C", - Address: "stellar-full-validator2.bdnodes.net", - History: "curl -sf https://stellar-full-history2.bdnodes.net/{0} -o {1}", - }, - { - Name: "Blockdaemon_Validator_3", - HomeDomain: "stellar.blockdaemon.com", - PublicKey: "GAYXZ4PZ7P6QOX7EBHPIZXNWY4KCOBYWJCA4WKWRKC7XIUS3UJPT6EZ4", - Address: "stellar-full-validator3.bdnodes.net", - History: "curl -sf https://stellar-full-history3.bdnodes.net/{0} -o {1}", - }, - { - Name: "wirexUS", - HomeDomain: "wirexapp.com", - PublicKey: "GDXUKFGG76WJC7ACEH3JUPLKM5N5S76QSMNDBONREUXPCZYVPOLFWXUS", - Address: "us.stellar.wirexapp.com", - History: "curl -sf http://wxhorizonusstga1.blob.core.windows.net/history/{0} -o {1}", - }, - { - Name: "wirexUK", - HomeDomain: "wirexapp.com", - PublicKey: "GBBQQT3EIUSXRJC6TGUCGVA3FVPXVZLGG3OJYACWBEWYBHU46WJLWXEU", - Address: "uk.stellar.wirexapp.com", - History: "curl -sf http://wxhorizonukstga1.blob.core.windows.net/history/{0} -o {1}", - }, - { - Name: "wirexSG", - HomeDomain: "wirexapp.com", - PublicKey: "GAB3GZIE6XAYWXGZUDM4GMFFLJBFMLE2JDPUCWUZXMOMT3NHXDHEWXAS", - Address: "sg.stellar.wirexapp.com", - History: "curl -sf http://wxhorizonasiastga1.blob.core.windows.net/history/{0} -o {1}", - }, - } - - return &captiveCoreToml -} - // NewCaptiveCoreToml constructs a new CaptiveCoreToml instance based off // the configuration in `params`. func NewCaptiveCoreToml(params CaptiveCoreTomlParams) (*CaptiveCoreToml, error) { diff --git a/services/horizon/configs/captive-core-pubnet.cfg b/services/horizon/configs/captive-core-pubnet.cfg new file mode 100644 index 0000000000..2fcbdf96b6 --- /dev/null +++ b/services/horizon/configs/captive-core-pubnet.cfg @@ -0,0 +1,193 @@ +# WARNING! Do not use this config in production. Quorum sets should +# be carefully selected manually. +NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015" +HTTP_PORT=11626 + +[[HOME_DOMAINS]] +HOME_DOMAIN="stellar.org" +QUALITY="HIGH" + +[[HOME_DOMAINS]] +HOME_DOMAIN="satoshipay.io" +QUALITY="HIGH" + +[[HOME_DOMAINS]] +HOME_DOMAIN="lobstr.co" +QUALITY="HIGH" + +[[HOME_DOMAINS]] +HOME_DOMAIN="www.coinqvest.com" +QUALITY="HIGH" + +[[HOME_DOMAINS]] +HOME_DOMAIN="keybase.io" +QUALITY="HIGH" + +[[HOME_DOMAINS]] +HOME_DOMAIN="stellar.blockdaemon.com" +QUALITY="HIGH" + +[[HOME_DOMAINS]] +HOME_DOMAIN="wirexapp.com" +QUALITY="HIGH" + +[[VALIDATORS]] +NAME="sdf_1" +HOME_DOMAIN="stellar.org" +PUBLIC_KEY="GCGB2S2KGYARPVIA37HYZXVRM2YZUEXA6S33ZU5BUDC6THSB62LZSTYH" +ADDRESS="core-live-a.stellar.org:11625" +HISTORY="curl -sf https://history.stellar.org/prd/core-live/core_live_001/{0} -o {1}" + +[[VALIDATORS]] +NAME="sdf_2" +HOME_DOMAIN="stellar.org" +PUBLIC_KEY="GCM6QMP3DLRPTAZW2UZPCPX2LF3SXWXKPMP3GKFZBDSF3QZGV2G5QSTK" +ADDRESS="core-live-b.stellar.org:11625" +HISTORY="curl -sf https://history.stellar.org/prd/core-live/core_live_002/{0} -o {1}" + +[[VALIDATORS]] +NAME="sdf_3" +HOME_DOMAIN="stellar.org" +PUBLIC_KEY="GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ" +ADDRESS="core-live-c.stellar.org:11625" +HISTORY="curl -sf https://history.stellar.org/prd/core-live/core_live_003/{0} -o {1}" + +[[VALIDATORS]] +NAME="satoshipay_singapore" +HOME_DOMAIN="satoshipay.io" +PUBLIC_KEY="GBJQUIXUO4XSNPAUT6ODLZUJRV2NPXYASKUBY4G5MYP3M47PCVI55MNT" +ADDRESS="stellar-sg-sin.satoshipay.io:11625" +HISTORY="curl -sf https://stellar-history-sg-sin.satoshipay.io/{0} -o {1}" + +[[VALIDATORS]] +NAME="satoshipay_iowa" +HOME_DOMAIN="satoshipay.io" +PUBLIC_KEY="GAK6Z5UVGUVSEK6PEOCAYJISTT5EJBB34PN3NOLEQG2SUKXRVV2F6HZY" +ADDRESS="stellar-us-iowa.satoshipay.io:11625" +HISTORY="curl -sf https://stellar-history-us-iowa.satoshipay.io/{0} -o {1}" + +[[VALIDATORS]] +NAME="satoshipay_frankfurt" +HOME_DOMAIN="satoshipay.io" +PUBLIC_KEY="GC5SXLNAM3C4NMGK2PXK4R34B5GNZ47FYQ24ZIBFDFOCU6D4KBN4POAE" +ADDRESS="stellar-de-fra.satoshipay.io:11625" +HISTORY="curl -sf https://stellar-history-de-fra.satoshipay.io/{0} -o {1}" + +[[VALIDATORS]] +NAME="lobstr_1_europe" +HOME_DOMAIN="lobstr.co" +PUBLIC_KEY="GCFONE23AB7Y6C5YZOMKUKGETPIAJA4QOYLS5VNS4JHBGKRZCPYHDLW7" +ADDRESS="v1.stellar.lobstr.co:11625" +HISTORY="curl -sf https://stellar-archive-1-lobstr.s3.amazonaws.com/{0} -o {1}" + +[[VALIDATORS]] +NAME="lobstr_2_europe" +HOME_DOMAIN="lobstr.co" +PUBLIC_KEY="GDXQB3OMMQ6MGG43PWFBZWBFKBBDUZIVSUDAZZTRAWQZKES2CDSE5HKJ" +ADDRESS="v2.stellar.lobstr.co:11625" +HISTORY="curl -sf https://stellar-archive-2-lobstr.s3.amazonaws.com/{0} -o {1}" + +[[VALIDATORS]] +NAME="lobstr_3_north_america" +HOME_DOMAIN="lobstr.co" +PUBLIC_KEY="GD5QWEVV4GZZTQP46BRXV5CUMMMLP4JTGFD7FWYJJWRL54CELY6JGQ63" +ADDRESS="v3.stellar.lobstr.co:11625" +HISTORY="curl -sf https://stellar-archive-3-lobstr.s3.amazonaws.com/{0} -o {1}" + +[[VALIDATORS]] +NAME="lobstr_4_asia" +HOME_DOMAIN="lobstr.co" +PUBLIC_KEY="GA7TEPCBDQKI7JQLQ34ZURRMK44DVYCIGVXQQWNSWAEQR6KB4FMCBT7J" +ADDRESS="v4.stellar.lobstr.co:11625" +HISTORY="curl -sf https://stellar-archive-4-lobstr.s3.amazonaws.com/{0} -o {1}" + +[[VALIDATORS]] +NAME="lobstr_5_australia" +HOME_DOMAIN="lobstr.co" +PUBLIC_KEY="GA5STBMV6QDXFDGD62MEHLLHZTPDI77U3PFOD2SELU5RJDHQWBR5NNK7" +ADDRESS="v5.stellar.lobstr.co:11625" +HISTORY="curl -sf https://stellar-archive-5-lobstr.s3.amazonaws.com/{0} -o {1}" + +[[VALIDATORS]] +NAME="coinqvest_hong_kong" +HOME_DOMAIN="www.coinqvest.com" +PUBLIC_KEY="GAZ437J46SCFPZEDLVGDMKZPLFO77XJ4QVAURSJVRZK2T5S7XUFHXI2Z" +ADDRESS="hongkong.stellar.coinqvest.com:11625" +HISTORY="curl -sf https://hongkong.stellar.coinqvest.com/history/{0} -o {1}" + +[[VALIDATORS]] +NAME="coinqvest_germany" +HOME_DOMAIN="www.coinqvest.com" +PUBLIC_KEY="GD6SZQV3WEJUH352NTVLKEV2JM2RH266VPEM7EH5QLLI7ZZAALMLNUVN" +ADDRESS="germany.stellar.coinqvest.com:11625" +HISTORY="curl -sf https://germany.stellar.coinqvest.com/history/{0} -o {1}" + +[[VALIDATORS]] +NAME="coinqvest_finland" +HOME_DOMAIN="www.coinqvest.com" +PUBLIC_KEY="GADLA6BJK6VK33EM2IDQM37L5KGVCY5MSHSHVJA4SCNGNUIEOTCR6J5T" +ADDRESS="finland.stellar.coinqvest.com:11625" +HISTORY="curl -sf https://finland.stellar.coinqvest.com/history/{0} -o {1}" + +[[VALIDATORS]] +NAME="keybase_io" +HOME_DOMAIN="keybase.io" +PUBLIC_KEY="GCWJKM4EGTGJUVSWUJDPCQEOEP5LHSOFKSA4HALBTOO4T4H3HCHOM6UX" +ADDRESS="stellar0.keybase.io:11625" +HISTORY="curl -sf https://stellarhistory.keybase.io/{0} -o {1}" + +[[VALIDATORS]] +NAME="keybase_1" +HOME_DOMAIN="keybase.io" +PUBLIC_KEY="GDKWELGJURRKXECG3HHFHXMRX64YWQPUHKCVRESOX3E5PM6DM4YXLZJM" +ADDRESS="stellar1.keybase.io:11625" +HISTORY="curl -sf https://stellarhistory1.keybase.io/{0} -o {1}" + +[[VALIDATORS]] +NAME="keybase_2" +HOME_DOMAIN="keybase.io" +PUBLIC_KEY="GA35T3723UP2XJLC2H7MNL6VMKZZIFL2VW7XHMFFJKKIA2FJCYTLKFBW" +ADDRESS="stellar2.keybase.io:11625" +HISTORY="curl -sf https://stellarhistory2.keybase.io/{0} -o {1}" + +[[VALIDATORS]] +NAME="Blockdaemon_Validator_1" +HOME_DOMAIN="stellar.blockdaemon.com" +PUBLIC_KEY="GAAV2GCVFLNN522ORUYFV33E76VPC22E72S75AQ6MBR5V45Z5DWVPWEU" +ADDRESS="stellar-full-validator1.bdnodes.net" +HISTORY="curl -sf https://stellar-full-history1.bdnodes.net/{0} -o {1}" + +[[VALIDATORS]] +NAME="Blockdaemon_Validator_2" +HOME_DOMAIN="stellar.blockdaemon.com" +PUBLIC_KEY="GAVXB7SBJRYHSG6KSQHY74N7JAFRL4PFVZCNWW2ARI6ZEKNBJSMSKW7C" +ADDRESS="stellar-full-validator2.bdnodes.net" +HISTORY="curl -sf https://stellar-full-history2.bdnodes.net/{0} -o {1}" + +[[VALIDATORS]] +NAME="Blockdaemon_Validator_3" +HOME_DOMAIN="stellar.blockdaemon.com" +PUBLIC_KEY="GAYXZ4PZ7P6QOX7EBHPIZXNWY4KCOBYWJCA4WKWRKC7XIUS3UJPT6EZ4" +ADDRESS="stellar-full-validator3.bdnodes.net" +HISTORY="curl -sf https://stellar-full-history3.bdnodes.net/{0} -o {1}" + +[[VALIDATORS]] +NAME="wirexUS" +ADDRESS="us.stellar.wirexapp.com" +HOME_DOMAIN="wirexapp.com" +PUBLIC_KEY="GDXUKFGG76WJC7ACEH3JUPLKM5N5S76QSMNDBONREUXPCZYVPOLFWXUS" +HISTORY="curl -sf http://wxhorizonusstga1.blob.core.windows.net/history/{0} -o {1}" + +[[VALIDATORS]] +NAME="wirexUK" +ADDRESS="uk.stellar.wirexapp.com" +HOME_DOMAIN="wirexapp.com" +PUBLIC_KEY="GBBQQT3EIUSXRJC6TGUCGVA3FVPXVZLGG3OJYACWBEWYBHU46WJLWXEU" +HISTORY="curl -sf http://wxhorizonukstga1.blob.core.windows.net/history/{0} -o {1}" + +[[VALIDATORS]] +NAME="wirexSG" +ADDRESS="sg.stellar.wirexapp.com" +HOME_DOMAIN="wirexapp.com" +PUBLIC_KEY="GAB3GZIE6XAYWXGZUDM4GMFFLJBFMLE2JDPUCWUZXMOMT3NHXDHEWXAS" +HISTORY="curl -sf http://wxhorizonasiastga1.blob.core.windows.net/history/{0} -o {1}" \ No newline at end of file diff --git a/services/horizon/configs/captive-core-testnet.cfg b/services/horizon/configs/captive-core-testnet.cfg new file mode 100644 index 0000000000..9abeecc8f5 --- /dev/null +++ b/services/horizon/configs/captive-core-testnet.cfg @@ -0,0 +1,28 @@ +NETWORK_PASSPHRASE="Test SDF Network ; September 2015" +UNSAFE_QUORUM=true +FAILURE_SAFETY=1 + +[[HOME_DOMAINS]] +HOME_DOMAIN="testnet.stellar.org" +QUALITY="HIGH" + +[[VALIDATORS]] +NAME="sdf_testnet_1" +HOME_DOMAIN="testnet.stellar.org" +PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" +ADDRESS="core-testnet1.stellar.org" +HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_001/{0} -o {1}" + +[[VALIDATORS]] +NAME="sdf_testnet_2" +HOME_DOMAIN="testnet.stellar.org" +PUBLIC_KEY="GCUCJTIYXSOXKBSNFGNFWW5MUQ54HKRPGJUTQFJ5RQXZXNOLNXYDHRAP" +ADDRESS="core-testnet2.stellar.org" +HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_002/{0} -o {1}" + +[[VALIDATORS]] +NAME="sdf_testnet_3" +HOME_DOMAIN="testnet.stellar.org" +PUBLIC_KEY="GC2V2EFSXN6SQTWVYA5EPJPBWWIMSD2XQNKUOHGEKB535AQE2I6IXV2Z" +ADDRESS="core-testnet3.stellar.org" +HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_003/{0} -o {1}" \ No newline at end of file diff --git a/services/horizon/internal/app.go b/services/horizon/internal/app.go index bdb611bdf1..b84c8bc049 100644 --- a/services/horizon/internal/app.go +++ b/services/horizon/internal/app.go @@ -121,16 +121,18 @@ func (a *App) Serve() { signal.Notify(signalChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) if a.config.UsingDefaultPubnetConfig { - // If Horizon was started using default pubnet configuration kill it - // after one hour with error message. - const errorMsg = "Horizon started using the default pubnet configuration. " + - "Because this is not safe it will be shut down after one hour. " + - "Please provide a custom --captive-core-config-path." - log.Error(errorMsg) + const warnMsg = "Horizon started using the default pubnet configuration. " + + "This is not safe! Please provide a custom --captive-core-config-path." + log.Warn(warnMsg) go func() { - time.Sleep(time.Hour) - log.Error(errorMsg) - signalChan <- syscall.SIGINT + for { + select { + case <-time.After(time.Hour): + log.Warn(warnMsg) + case <-a.done: + return + } + } }() } diff --git a/services/horizon/internal/flags.go b/services/horizon/internal/flags.go index d9a4ec2f73..9d9d9c1fcd 100644 --- a/services/horizon/internal/flags.go +++ b/services/horizon/internal/flags.go @@ -6,6 +6,7 @@ import ( stdLog "log" "os" "os/exec" + "path/filepath" "strings" "github.com/sirupsen/logrus" @@ -539,17 +540,36 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption if config.RemoteCaptiveCoreURL == "" && (binaryPath == "" || config.CaptiveCoreConfigPath == "") { if options.RequireCaptiveCoreConfig { + var err error + errorMessage := fmt.Sprintf( + "Invalid config: captive core requires that both --%s and --%s are set. %s", + StellarCoreBinaryPathName, CaptiveCoreConfigPathName, captiveCoreMigrationHint, + ) + + var configFileName string + // Default config files will be located along the binary in the release archive. switch config.NetworkPassphrase { case network.TestNetworkPassphrase: - config.CaptiveCoreToml = ledgerbackend.NewDefaultTestnetCaptiveCoreToml() + configFileName = "captive-core-testnet.cfg" config.HistoryArchiveURLs = []string{"https://history.stellar.org/prd/core-testnet/core_testnet_001/"} case network.PublicNetworkPassphrase: - config.CaptiveCoreToml = ledgerbackend.NewDefaultPubnetCaptiveCoreToml() + configFileName = "captive-core-pubnet.cfg" config.HistoryArchiveURLs = []string{"https://history.stellar.org/prd/core-live/core_live_001/"} config.UsingDefaultPubnetConfig = true default: - stdLog.Fatalf("Invalid config: captive core requires that both --%s and --%s are set. %s", - StellarCoreBinaryPathName, CaptiveCoreConfigPathName, captiveCoreMigrationHint) + stdLog.Fatal(errorMessage) + } + + executablePath, err := os.Executable() + if err != nil { + stdLog.Fatal(errorMessage) + } + + config.CaptiveCoreConfigPath = filepath.Join(filepath.Dir(executablePath), configFileName) + config.CaptiveCoreTomlParams.NetworkPassphrase = config.NetworkPassphrase + config.CaptiveCoreToml, err = ledgerbackend.NewCaptiveCoreTomlFromFile(config.CaptiveCoreConfigPath, config.CaptiveCoreTomlParams) + if err != nil { + stdLog.Fatalf("Invalid captive core toml file %v", err) } } else { var err error diff --git a/support/scripts/build_release_artifacts/main.go b/support/scripts/build_release_artifacts/main.go index 9fc08cec79..f0d4cdd9bb 100644 --- a/support/scripts/build_release_artifacts/main.go +++ b/support/scripts/build_release_artifacts/main.go @@ -305,6 +305,11 @@ func prepareDest(pkg, bin, version, os, arch string) string { run("cp", "COPYING", dest) run("cp", filepath.Join(pkg, "README.md"), dest) run("cp", filepath.Join(pkg, "CHANGELOG.md"), dest) + if bin == "horizon" { + // Add default config files for Captive-Core + run("cp", filepath.Join(pkg, "configs/captive-core-pubnet.cfg"), dest) + run("cp", filepath.Join(pkg, "configs/captive-core-testnet.cfg"), dest) + } return dest } From e1c4cc65b516fb6cdb9ac84bbedce4a451a5bfd5 Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Fri, 30 Jul 2021 15:59:53 +0200 Subject: [PATCH 4/5] check if file exist --- services/horizon/internal/flags.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/horizon/internal/flags.go b/services/horizon/internal/flags.go index 9d9d9c1fcd..52de0739c9 100644 --- a/services/horizon/internal/flags.go +++ b/services/horizon/internal/flags.go @@ -566,6 +566,10 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption } config.CaptiveCoreConfigPath = filepath.Join(filepath.Dir(executablePath), configFileName) + if _, err := os.Stat(config.CaptiveCoreConfigPath); os.IsNotExist(err) { + stdLog.Fatal(errorMessage) + } + config.CaptiveCoreTomlParams.NetworkPassphrase = config.NetworkPassphrase config.CaptiveCoreToml, err = ledgerbackend.NewCaptiveCoreTomlFromFile(config.CaptiveCoreConfigPath, config.CaptiveCoreTomlParams) if err != nil { From 055dedadc1132b0636aca73748c172c3fbd1c720 Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Fri, 30 Jul 2021 16:07:23 +0200 Subject: [PATCH 5/5] fix shadow --- services/horizon/internal/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/horizon/internal/flags.go b/services/horizon/internal/flags.go index 52de0739c9..0bc0036142 100644 --- a/services/horizon/internal/flags.go +++ b/services/horizon/internal/flags.go @@ -566,7 +566,7 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption } config.CaptiveCoreConfigPath = filepath.Join(filepath.Dir(executablePath), configFileName) - if _, err := os.Stat(config.CaptiveCoreConfigPath); os.IsNotExist(err) { + if _, err = os.Stat(config.CaptiveCoreConfigPath); os.IsNotExist(err) { stdLog.Fatal(errorMessage) }