Skip to content

Commit

Permalink
ci: fix feature gates
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 17, 2024
1 parent 36aa426 commit 54568a3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- serde
- esplora
- electrum
- mempool
- fs
- cli
- cli,hot
Expand Down
6 changes: 3 additions & 3 deletions src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use strict_encoding::Ident;
use crate::cli::{
Config, DescrStdOpts, DescriptorOpts, ExecError, GeneralOpts, ResolverOpt, WalletOpts,
};
use crate::indexers::Client as IndexerClient;
use crate::indexers::esplora;
use crate::{AnyIndexer, MayError, Wallet};

/// Command-line arguments
Expand Down Expand Up @@ -98,10 +98,10 @@ impl<C: Clone + Eq + Debug + Subcommand, O: DescriptorOpts> Args<C, O> {
let network = self.general.network.to_string();
Ok(match (&self.resolver.esplora, &self.resolver.electrum, &self.resolver.mempool) {
(None, Some(url), None) => AnyIndexer::Electrum(Box::new(electrum::Client::new(url)?)),
(Some(url), None, None) => AnyIndexer::Esplora(Box::new(IndexerClient::new_esplora(
(Some(url), None, None) => AnyIndexer::Esplora(Box::new(esplora::Client::new_esplora(
&url.replace("{network}", &network),
)?)),
(None, None, Some(url)) => AnyIndexer::Mempool(Box::new(IndexerClient::new_mempool(
(None, None, Some(url)) => AnyIndexer::Mempool(Box::new(esplora::Client::new_mempool(
&url.replace("{network}", &network),
)?)),
_ => {
Expand Down
3 changes: 3 additions & 0 deletions src/indexers/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ pub enum AnyIndexer {
impl AnyIndexer {
pub fn name(&self) -> &'static str {
match self {
#[cfg(feature = "electrum")]
AnyIndexer::Electrum(_) => "electrum",
#[cfg(feature = "esplora")]
AnyIndexer::Esplora(_) => "esplora",
#[cfg(feature = "mempool")]
AnyIndexer::Mempool(_) => "mempool",
}
}
Expand Down
1 change: 1 addition & 0 deletions src/indexers/esplora.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ fn get_scripthash_txs_all(
let mut res = Vec::new();
let mut last_seen = None;
let script = derive.addr.script_pubkey();
#[cfg(feature = "mempool")]
let address = derive.addr.to_string();

loop {
Expand Down
2 changes: 1 addition & 1 deletion src/indexers/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use bpstd::Txid;
use esplora::BlockingClient;

impl super::Client {
impl super::esplora::Client {
/// Creates a new mempool client with the specified URL.
///
/// # Arguments
Expand Down
8 changes: 3 additions & 5 deletions src/indexers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@
// limitations under the License.

#[cfg(feature = "electrum")]
mod electrum;
pub mod electrum;
#[cfg(feature = "esplora")]
mod esplora;
pub mod esplora;
#[cfg(feature = "mempool")]
mod mempool;
pub mod mempool;
#[cfg(any(feature = "electrum", feature = "esplora", feature = "mempool"))]
mod any;

#[cfg(any(feature = "electrum", feature = "esplora", feature = "mempool"))]
pub use any::{AnyIndexer, AnyIndexerError};
use bpstd::Tx;
use descriptors::Descriptor;
#[cfg(any(feature = "esplora", feature = "mempool"))]
pub use esplora::Client;

use crate::{Layer2, MayError, WalletCache, WalletDescr};

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern crate clap;
#[cfg(feature = "log")]
extern crate log;

mod indexers;
pub mod indexers;
mod util;
mod data;
mod rows;
Expand All @@ -54,7 +54,7 @@ pub use hot::{HotArgs, HotCommand};
#[cfg(feature = "hot")]
pub use hot::{Seed, SeedType};
pub use indexers::Indexer;
#[cfg(any(feature = "electrum", feature = "esplora"))]
#[cfg(any(feature = "electrum", feature = "esplora", feature = "mempool"))]
pub use indexers::{AnyIndexer, AnyIndexerError};
pub use layer2::{
Layer2, Layer2Cache, Layer2Coin, Layer2Data, Layer2Descriptor, Layer2Tx, NoLayer2,
Expand Down

0 comments on commit 54568a3

Please sign in to comment.