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

payjoin / rust-payjoin / 15934923586

27 Jun 2025 08:02PM UTC coverage: 85.492% (-0.7%) from 86.155%
15934923586

push

github

web-flow
0.24 name audit part 2 (#810)

I was also getting confused by the similar `Receiver<State>` and
`ReceiverTypeState` type names, so I went with `ReceiveSession` for the
enum, which may not have initialized a `Receiver` yet, and might have
even failed. This rename pattern was applied to `SenderTypeState` as
well. I kept "Receive" in "ReceiveSession" to disambiguate between
Sessions for payjoin-ffi since the disambiguation applies to
payjoin-cli/v2 for the time being until that module is separated into
send/receive submodules as well.

54 of 66 new or added lines in 5 files covered. (81.82%)

36 existing lines in 17 files now uncovered.

7254 of 8485 relevant lines covered (85.49%)

547.58 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

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

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

14
#[tokio::main]
15
async fn main() -> Result<()> {
10✔
16
    env_logger::init();
10✔
17

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

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

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

72
    Ok(())
18✔
73
}
10✔
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