From 8b85c497aa5f837b46d4b060f53463ba91a8663d Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Fri, 30 Jul 2021 15:07:17 +0200 Subject: [PATCH] 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 }