From d362da68f9cf65df0d7bc185bb8e38b9086b58c6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 10 Jul 2025 20:51:57 +0000 Subject: [PATCH 1/4] Initial plan From 91456be02bb6315eef9d896ff32270d285c4a62c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 10 Jul 2025 20:59:18 +0000 Subject: [PATCH 2/4] Fix core version appearing as empty string in Horizon API Extract stellar-core version and pass it to Horizon via STELLAR_CORE_VERSION environment variable Co-authored-by: sagpatil <1414227+sagpatil@users.noreply.github.com> --- start | 4 +++ tests/test_core_version.go | 54 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 tests/test_core_version.go diff --git a/start b/start index a73ed8e3a..c3beec81c 100644 --- a/start +++ b/start @@ -76,6 +76,9 @@ function validate_after_copy_defaults() { function start() { echo "Starting Stellar Quickstart" + # Extract stellar-core version for horizon configuration + export STELLAR_CORE_VERSION=$(stellar-core version 2>/dev/null | head -1 | xargs) + echo "versions:" echo " quickstart: $REVISION" echo " stellar-core:" @@ -489,6 +492,7 @@ function init_horizon() { cat << EOF >> etc/horizon.env export CAPTIVE_CORE_CONFIG_PATH=$HORIZON_CAPTIVE_CORE_CFG export CAPTIVE_CORE_STORAGE_PATH=$HZHOME/captive-core +export STELLAR_CORE_VERSION=$STELLAR_CORE_VERSION EOF run_silent "chown-horizon" chown -R stellar:stellar . diff --git a/tests/test_core_version.go b/tests/test_core_version.go new file mode 100644 index 000000000..694c0207e --- /dev/null +++ b/tests/test_core_version.go @@ -0,0 +1,54 @@ +package main + +import ( + "encoding/json" + "log" + "net/http" + "os" + "time" +) + +const timeout = 3 * time.Minute + +type Root struct { + StellarCoreVersion string `json:"core_version"` +} + +func main() { + startTime := time.Now() + + for { + time.Sleep(5 * time.Second) + logLine("Waiting for Horizon to start and checking core_version") + + if time.Since(startTime) > timeout { + logLine("Timeout") + os.Exit(-1) + } + + resp, err := http.Get("http://localhost:8000") + if err != nil { + logLine(err) + continue + } + + var root Root + decoder := json.NewDecoder(resp.Body) + err = decoder.Decode(&root) + if err != nil { + logLine(err) + continue + } + + if root.StellarCoreVersion != "" { + logLine("SUCCESS: core_version is populated: " + root.StellarCoreVersion) + os.Exit(0) + } else { + logLine("core_version is still empty") + } + } +} + +func logLine(text interface{}) { + log.Println("\033[33;1m[core_version_test]\033[0m", text) +} \ No newline at end of file From 6f111e8534b6e817a50eb5d460a7d4ccfe402114 Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Sat, 11 Oct 2025 23:30:37 +1000 Subject: [PATCH 3/4] remove unused stellar core version export and update horizon config --- start | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/start b/start index 473bd3e05..f241e60fb 100755 --- a/start +++ b/start @@ -78,9 +78,6 @@ function validate_after_copy_defaults() { function start() { echo "Starting Stellar Quickstart" - # Extract stellar-core version for horizon configuration - export STELLAR_CORE_VERSION=$(stellar-core version 2>/dev/null | head -1 | xargs) - echo "versions:" echo " quickstart: $REVISION" echo " xdr:" @@ -505,7 +502,7 @@ function init_horizon() { cat << EOF >> etc/horizon.env export CAPTIVE_CORE_CONFIG_PATH=$HORIZON_CAPTIVE_CORE_CFG export CAPTIVE_CORE_STORAGE_PATH=$HZHOME/captive-core -export STELLAR_CORE_VERSION=$STELLAR_CORE_VERSION +export STELLAR_CORE_VERSION="$(stellar-core version 2>/dev/null | head -1)" EOF run_silent "chown-horizon" chown -R stellar:stellar . From 085bdcacc7c26ec0f6d75906a8df5a751c3f9222 Mon Sep 17 00:00:00 2001 From: Leigh <351529+leighmcculloch@users.noreply.github.com> Date: Sat, 11 Oct 2025 23:30:58 +1000 Subject: [PATCH 4/4] Delete tests/test_core_version.go --- tests/test_core_version.go | 54 -------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 tests/test_core_version.go diff --git a/tests/test_core_version.go b/tests/test_core_version.go deleted file mode 100644 index 694c0207e..000000000 --- a/tests/test_core_version.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -import ( - "encoding/json" - "log" - "net/http" - "os" - "time" -) - -const timeout = 3 * time.Minute - -type Root struct { - StellarCoreVersion string `json:"core_version"` -} - -func main() { - startTime := time.Now() - - for { - time.Sleep(5 * time.Second) - logLine("Waiting for Horizon to start and checking core_version") - - if time.Since(startTime) > timeout { - logLine("Timeout") - os.Exit(-1) - } - - resp, err := http.Get("http://localhost:8000") - if err != nil { - logLine(err) - continue - } - - var root Root - decoder := json.NewDecoder(resp.Body) - err = decoder.Decode(&root) - if err != nil { - logLine(err) - continue - } - - if root.StellarCoreVersion != "" { - logLine("SUCCESS: core_version is populated: " + root.StellarCoreVersion) - os.Exit(0) - } else { - logLine("core_version is still empty") - } - } -} - -func logLine(text interface{}) { - log.Println("\033[33;1m[core_version_test]\033[0m", text) -} \ No newline at end of file