From 96e0c582f45fd6ad430673fd90630d90808c7f11 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Tue, 6 Oct 2026 19:58:47 -0500 Subject: [PATCH 1/2] Fix channel manager read test without Esplora The `channel_manager_read_failure_fails_build` test never configured a chain source and relied on the builder's default Esplora fallback. Without the `chain-esplora` feature there is no fallback, so the build failed with `ChainSourceSetupFailed` before the channel manager read the test is meant to exercise. Configure an Esplora or Electrum chain source explicitly. Neither connects during `build`, so no server is needed. Skip the test if neither is enabled, as Bitcoind fetches the chain tip during `build` and fails before the channel manager read when no server is reachable. This change was written with the help of Claude Code. Co-Authored-By: Claude Opus 5.5 --- src/builder.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/builder.rs b/src/builder.rs index 29759e93a..991bc573e 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -2645,10 +2645,13 @@ pub(crate) fn sanitize_alias(alias_str: &str) -> Result { #[cfg(test)] mod tests { + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] use std::future::Future; use std::sync::Arc; + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] use lightning::io; + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] use lightning::util::persist::{ KVStore, PageToken, PaginatedKVStore, PaginatedListResponse, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE, @@ -2656,12 +2659,16 @@ mod tests { }; use super::{sanitize_alias, BuildError, NodeAlias, NodeBuilder}; + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] use crate::entropy::NodeEntropy; + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] use crate::io::test_utils::InMemoryStore; use crate::logger::Logger; + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] struct ChannelManagerReadFailingStore(InMemoryStore); + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] impl KVStore for ChannelManagerReadFailingStore { fn read( &self, primary_namespace: &str, secondary_namespace: &str, key: &str, @@ -2698,6 +2705,7 @@ mod tests { } } + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] impl PaginatedKVStore for ChannelManagerReadFailingStore { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, @@ -2712,9 +2720,17 @@ mod tests { } } + // Bitcoind fetches the chain tip during `build`, which fails before the channel manager read + // if no server is reachable. #[test] + #[cfg(any(feature = "chain-esplora", feature = "chain-electrum"))] fn channel_manager_read_failure_fails_build() { - let builder = NodeBuilder::new(); + // Esplora and Electrum don't connect during `build`, so no server is needed. + let mut builder = NodeBuilder::new(); + #[cfg(feature = "chain-esplora")] + builder.set_chain_source_esplora("http://127.0.0.1:3002".to_string(), None); + #[cfg(not(feature = "chain-esplora"))] + builder.set_chain_source_electrum("tcp://127.0.0.1:50001".to_string(), None); let logger = Arc::new(Logger::new_log_facade()); #[cfg(not(feature = "uniffi"))] let node_entropy = NodeEntropy::from_seed_bytes([42; 64]); From f2a4f2c9b1a1c4e53f8d4ead2b9d8340e1026ed4 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Tue, 6 Oct 2026 19:58:48 -0500 Subject: [PATCH 2/2] Run lib tests for sparse PostgreSQL feature set The PostgreSQL workflow only compiled the library tests for the `chain-electrum,storage-postgres` feature set. Building and running the library tests for that set catches failures that only show up without the default features, such as tests that rely on the default Esplora chain source. Set `TEST_POSTGRES_URL` on the step so that the PostgreSQL store tests use the workflow's PostgreSQL service, the same as the later steps. This change was written with the help of Claude Code. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/postgres-integration.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/postgres-integration.yml b/.github/workflows/postgres-integration.yml index d27e3123e..29bd723d4 100644 --- a/.github/workflows/postgres-integration.yml +++ b/.github/workflows/postgres-integration.yml @@ -35,9 +35,11 @@ jobs: - name: Check all features run: cargo check --all-features --tests --verbose --color always - name: Check sparse feature sets + env: + TEST_POSTGRES_URL: "host=localhost user=postgres password=postgres" run: | cargo check --no-default-features --features uniffi,chain-bitcoind,storage-postgres --verbose --color always - cargo test --lib --no-run --no-default-features --features chain-electrum,storage-postgres --verbose --color always + cargo test --lib --no-default-features --features chain-electrum,storage-postgres --verbose --color always cargo check --test integration_tests_postgres --no-default-features --features chain-electrum,storage-postgres --verbose --color always - name: Enable caching for bitcoind id: cache-bitcoind