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

payjoin / rust-payjoin / 25944298217

15 May 2026 10:24PM UTC coverage: 85.039% (-0.3%) from 85.293%
25944298217

Pull #1558

github

web-flow
Merge 56641ee5a into b69034f35
Pull Request #1558: Receiver fallback typestate

683 of 856 new or added lines in 7 files covered. (79.79%)

8 existing lines in 2 files now uncovered.

12226 of 14377 relevant lines covered (85.04%)

377.13 hits per line

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

71.43
/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::filter::LevelFilter;
7
use tracing_subscriber::EnvFilter;
8

9
#[cfg(feature = "v2")]
10
use crate::db::v2::SessionId;
11

12
mod app;
13
mod cli;
14
mod db;
15

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

19
#[tokio::main]
20
async fn main() -> Result<()> {
16✔
21
    let env_filter =
16✔
22
        EnvFilter::builder().with_default_directive(LevelFilter::INFO.into()).from_env_lossy();
16✔
23
    tracing_subscriber::fmt().with_target(true).with_level(true).with_env_filter(env_filter).init();
16✔
24

25
    let cli = Cli::parse();
16✔
26
    let config = Config::new(&cli)?;
16✔
27

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

66
    match &cli.command {
16✔
67
        Commands::Send { bip21, fee_rate } => {
6✔
68
            app.send_payjoin(bip21, *fee_rate).await?;
6✔
69
        }
70
        Commands::Receive { amount, .. } => {
5✔
71
            app.receive_payjoin(*amount).await?;
5✔
72
        }
73
        #[cfg(feature = "v2")]
74
        Commands::Resume => {
75
            app.resume_payjoins().await?;
4✔
76
        }
77
        #[cfg(feature = "v2")]
78
        Commands::History => {
79
            app.history().await?;
×
80
        }
81
        #[cfg(feature = "v2")]
82
        Commands::Fallback { session_id } => {
1✔
83
            app.fallback_sender(SessionId(*session_id)).await?;
1✔
84
        }
85
        #[cfg(feature = "v2")]
NEW
86
        Commands::Cancel { session_id } => {
×
NEW
87
            app.cancel_receiver(SessionId(*session_id)).await?;
×
88
        }
89
        #[cfg(feature = "v2")]
NEW
90
        Commands::CancelWithoutBroadcast { session_id } => {
×
NEW
91
            app.cancel_receiver_without_broadcast(SessionId(*session_id)).await?;
×
92
        }
93
    };
94

95
    Ok(())
28✔
96
}
16✔
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