From 66884165edfc26f9c1ec80d9a310fd948e49bb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zoe=20Faltib=C3=A0?= Date: Tue, 4 Aug 2026 18:24:09 +0200 Subject: [PATCH] use rgb-lib electrum/esplora features --- .github/workflows/build.yml | 2 +- ci/check-lint.sh | 2 +- lightning-invoice/Cargo.toml | 5 +---- lightning/Cargo.toml | 8 ++++---- lightning/src/rgb_utils/mod.rs | 5 +++++ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ebb1bf72..cb0cf6d5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: run: echo "RUSTFLAGS=-C linker=rust-lld" >> "$GITHUB_ENV" - name: Build the workspace shell: bash # Default on Winblows is powershell - run: cargo check --workspace --verbose --color always + run: cargo check --workspace --features lightning/electrum --verbose --color always linting: runs-on: ubuntu-latest diff --git a/ci/check-lint.sh b/ci/check-lint.sh index 9f4ec48e4..a0a15e815 100755 --- a/ci/check-lint.sh +++ b/ci/check-lint.sh @@ -114,4 +114,4 @@ CLIPPY() { -A clippy::uninlined-format-args } -CLIPPY +CLIPPY "--features lightning/electrum" diff --git a/lightning-invoice/Cargo.toml b/lightning-invoice/Cargo.toml index 8780e1b79..dc6369cb9 100644 --- a/lightning-invoice/Cargo.toml +++ b/lightning-invoice/Cargo.toml @@ -24,10 +24,7 @@ serde = { version = "1.0", optional = true, default-features = false, features = bitcoin = { version = "0.32.2", default-features = false, features = ["secp-recovery"] } # RGB and related -rgb-lib = { version = "=0.3.0-beta.7", features = [ - "electrum", - "esplora", -] } +rgb-lib = { version = "=0.3.0-beta.7", default-features = false } [dev-dependencies] serde_json = { version = "1"} diff --git a/lightning/Cargo.toml b/lightning/Cargo.toml index e281c5b58..350478414 100644 --- a/lightning/Cargo.toml +++ b/lightning/Cargo.toml @@ -28,6 +28,9 @@ std = [] dnssec = ["dnssec-prover/validation"] +electrum = ["rgb-lib/electrum"] +esplora = ["rgb-lib/esplora"] + # Generates low-r bitcoin signatures, which saves 1 byte in 50% of the cases grind_signatures = [] @@ -53,10 +56,7 @@ inventory = { version = "0.3", optional = true } # RGB and related futures = "0.3" -rgb-lib = { version = "=0.3.0-beta.7", features = [ - "electrum", - "esplora", -] } +rgb-lib = { version = "=0.3.0-beta.7", default-features = false } serde = { version = "^1.0", features = [ "derive", ] } diff --git a/lightning/src/rgb_utils/mod.rs b/lightning/src/rgb_utils/mod.rs index b83579ad3..922550885 100644 --- a/lightning/src/rgb_utils/mod.rs +++ b/lightning/src/rgb_utils/mod.rs @@ -1,5 +1,10 @@ //! A module to provide RGB functionality +// this module uses the online APIs of rgb-lib, which are only available if rgb-lib has been built +// with support for at least one indexer protocol +#[cfg(not(any(feature = "electrum", feature = "esplora")))] +compile_error!("at least one of the `electrum` and `esplora` features needs to be enabled"); + use crate::ln::chan_utils::{ get_countersigner_payment_script, BuiltCommitmentTransaction, ClosingTransaction, CommitmentTransaction, HTLCOutputInCommitment,