cd lightning-transaction-sync
cargo build --verbose --color always --features esplora-blocking
cargo build --verbose --color always --features esplora-async
+ cargo build --verbose --color always --features esplora-async-https
- name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
if: "matrix.build-tx-sync && matrix.coverage"
run: |
cd lightning-transaction-sync
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
+ RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async-https
- name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
if: "matrix.build-tx-sync"
run: |
cd lightning-transaction-sync
cargo test --verbose --color always --features esplora-blocking
cargo test --verbose --color always --features esplora-async
+ cargo test --verbose --color always --features esplora-async-https
- name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
if: "matrix.toolchain == 'stable'"
shell: bash # Default on Winblows is powershell
[features]
default = []
esplora-async = ["async-interface", "esplora-client/async", "futures"]
+esplora-async-https = ["esplora-async", "reqwest/rustls-tls"]
esplora-blocking = ["esplora-client/blocking"]
async-interface = []
bdk-macros = "0.6"
futures = { version = "0.3", optional = true }
esplora-client = { version = "0.3.0", default-features = false, optional = true }
+reqwest = { version = "0.11", optional = true, default-features = false, features = ["json"] }
[dev-dependencies]
lightning = { version = "0.0.114", path = "../lightning", features = ["std"] }
//!
//! ## Features and Backend Support
//!
-//!- `esplora_blocking` enables syncing against an Esplora backend based on a blocking client.
-//!- `esplora_async` enables syncing against an Esplora backend based on an async client.
+//!- `esplora-blocking` enables syncing against an Esplora backend based on a blocking client.
+//!- `esplora-async` enables syncing against an Esplora backend based on an async client.
+//!- `esplora-async-https` enables the async Esplora client with support for HTTPS.
//!
//! ## Version Compatibility
//!
_ => panic!("Unexpected event"),
}
}
+
+#[tokio::test]
+#[cfg(any(feature = "esplora-async-https", feature = "esplora-blocking"))]
+async fn test_esplora_connects_to_public_server() {
+ let mut logger = TestLogger {};
+ let esplora_url = "https://blockstream.info/api".to_string();
+ let tx_sync = EsploraSyncClient::new(esplora_url, &mut logger);
+ let confirmable = TestConfirmable::new();
+
+ // Check we connect and pick up on new best blocks
+ assert_eq!(confirmable.best_block.lock().unwrap().1, 0);
+ #[cfg(feature = "esplora-async-https")]
+ tx_sync.sync(vec![&confirmable]).await.unwrap();
+ #[cfg(feature = "esplora-blocking")]
+ tx_sync.sync(vec![&confirmable]).unwrap();
+ assert_ne!(confirmable.best_block.lock().unwrap().1, 0);
+}