• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

payjoin / rust-payjoin / 17330603769

29 Aug 2025 05:43PM UTC coverage: 85.967%. Remained the same
17330603769

Pull #1020

github

web-flow
Merge a51fc34eb into 3873d6911
Pull Request #1020: use tracing crate instead of log

30 of 40 new or added lines in 15 files covered. (75.0%)

4 existing lines in 1 file now uncovered.

8166 of 9499 relevant lines covered (85.97%)

492.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/payjoin-cli/src/main.rs
1
use anyhow::Result;
2
use app::config::Config;
3
use app::App as AppTrait;
4
use clap::Parser;
5
use cli::{Cli, Commands};
6
use tracing_subscriber::EnvFilter;
7

8
mod app;
9
mod cli;
10
mod db;
11

12
#[cfg(not(any(feature = "v1", feature = "v2")))]
13
compile_error!("At least one of the features ['v1', 'v2'] must be enabled");
14

15
#[tokio::main]
16
async fn main() -> Result<()> {
12✔
17
    tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()).init();
12✔
18

19
    let cli = Cli::parse();
12✔
20
    let config = Config::new(&cli)?;
12✔
21

22
    #[allow(clippy::if_same_then_else)]
23
    let app: Box<dyn AppTrait> = if cli.flags.bip78.unwrap_or(false) {
12✔
24
        #[cfg(feature = "v1")]
25
        {
26
            Box::new(crate::app::v1::App::new(config).await?)
5✔
27
        }
28
        #[cfg(not(feature = "v1"))]
29
        {
30
            anyhow::bail!(
31
                "BIP78 (v1) support is not enabled in this build. Recompile with --features v1"
32
            )
33
        }
34
    } else if cli.flags.bip77.unwrap_or(false) {
7✔
35
        #[cfg(feature = "v2")]
36
        {
UNCOV
37
            Box::new(crate::app::v2::App::new(config).await?)
×
38
        }
39
        #[cfg(not(feature = "v2"))]
40
        {
UNCOV
41
            anyhow::bail!(
×
UNCOV
42
                "BIP77 (v2) support is not enabled in this build. Recompile with --features v2"
×
43
            )
44
        }
45
    } else {
46
        #[cfg(feature = "v2")]
47
        {
48
            Box::new(crate::app::v2::App::new(config).await?)
7✔
49
        }
50
        #[cfg(all(feature = "v1", not(feature = "v2")))]
51
        {
UNCOV
52
            Box::new(crate::app::v1::App::new(config).await?)
×
53
        }
54
        #[cfg(not(any(feature = "v1", feature = "v2")))]
55
        {
56
            anyhow::bail!("No valid version available - must compile with v1 or v2 feature")
57
        }
58
    };
59

60
    match &cli.command {
12✔
61
        Commands::Send { bip21, fee_rate } => {
5✔
62
            app.send_payjoin(bip21, *fee_rate).await?;
5✔
63
        }
64
        Commands::Receive { amount, .. } => {
4✔
65
            app.receive_payjoin(*amount).await?;
4✔
66
        }
67
        #[cfg(feature = "v2")]
68
        Commands::Resume => {
69
            app.resume_payjoins().await?;
3✔
70
        }
71
    };
72

73
    Ok(())
22✔
74
}
12✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc