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

payjoin / rust-payjoin / 13637705402

03 Mar 2025 06:23PM UTC coverage: 79.725% (+0.4%) from 79.302%
13637705402

push

github

web-flow
Multiparty Senders: NS1R (#434)

Let a receiver batch sends from multiple peers into one transaction.

407 of 477 new or added lines in 9 files covered. (85.32%)

1 existing line in 1 file now uncovered.

4530 of 5682 relevant lines covered (79.73%)

812.66 hits per line

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

0.0
/payjoin/src/send/multiparty/error.rs
1
use std::fmt::{self, Display};
2

3
use bitcoin::psbt::Error as PsbtError;
4

5
use crate::hpke::HpkeError;
6
use crate::ohttp::OhttpEncapsulationError;
7
use crate::receive::ImplementationError;
8
use crate::send::InternalProposalError;
9
use crate::uri::url_ext::ParseReceiverPubkeyParamError;
10

11
#[derive(Debug)]
12
pub struct CreateRequestError(InternalCreateRequestError);
13

14
#[derive(Debug)]
15
pub(crate) enum InternalCreateRequestError {
16
    #[allow(dead_code)]
17
    Expired(std::time::SystemTime),
18
    MissingOhttpConfig,
19
    ParseReceiverPubkeyParam(ParseReceiverPubkeyParamError),
20
    Url(url::ParseError),
21
    V2CreateRequest(crate::send::v2::CreateRequestError),
22
}
23

24
impl From<InternalCreateRequestError> for CreateRequestError {
NEW
25
    fn from(value: InternalCreateRequestError) -> Self { CreateRequestError(value) }
×
26
}
27

28
impl Display for CreateRequestError {
NEW
29
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) }
×
30
}
31

32
impl std::error::Error for CreateRequestError {
NEW
33
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
×
NEW
34
        match &self.0 {
×
NEW
35
            InternalCreateRequestError::Expired(_) => None,
×
NEW
36
            InternalCreateRequestError::MissingOhttpConfig => None,
×
NEW
37
            InternalCreateRequestError::ParseReceiverPubkeyParam(e) => Some(e),
×
NEW
38
            InternalCreateRequestError::Url(e) => Some(e),
×
NEW
39
            InternalCreateRequestError::V2CreateRequest(e) => Some(e),
×
40
        }
NEW
41
    }
×
42
}
43

44
#[derive(Debug)]
45
pub struct FinalizedError(InternalFinalizedError);
46

47
#[derive(Debug)]
48
pub(crate) enum InternalFinalizedError {
49
    Hpke(HpkeError),
50
    InvalidSize,
51
    #[allow(dead_code)]
52
    FinalizePsbt(ImplementationError),
53
    MissingResponse,
54
    Psbt(PsbtError),
55
    #[allow(dead_code)]
56
    UnexpectedStatusCode(http::StatusCode),
57
    Proposal(InternalProposalError),
58
    Ohttp(OhttpEncapsulationError),
59
}
60

61
impl From<InternalFinalizedError> for FinalizedError {
NEW
62
    fn from(value: InternalFinalizedError) -> Self { FinalizedError(value) }
×
63
}
64

65
impl Display for FinalizedError {
NEW
66
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) }
×
67
}
68

69
impl std::error::Error for FinalizedError {
NEW
70
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
×
NEW
71
        match &self.0 {
×
NEW
72
            InternalFinalizedError::Hpke(e) => Some(e),
×
NEW
73
            InternalFinalizedError::InvalidSize => None,
×
NEW
74
            InternalFinalizedError::FinalizePsbt(_) => None,
×
NEW
75
            InternalFinalizedError::MissingResponse => None,
×
NEW
76
            InternalFinalizedError::Psbt(e) => Some(e),
×
NEW
77
            InternalFinalizedError::UnexpectedStatusCode(_) => None,
×
NEW
78
            InternalFinalizedError::Proposal(e) => Some(e),
×
NEW
79
            InternalFinalizedError::Ohttp(e) => Some(e),
×
80
        }
NEW
81
    }
×
82
}
83

84
#[derive(Debug)]
85
pub struct FinalizeResponseError(InternalFinalizeResponseError);
86

87
#[derive(Debug)]
88
pub(crate) enum InternalFinalizeResponseError {
89
    #[allow(dead_code)]
90
    InvalidSize(usize),
91
    Ohttp(OhttpEncapsulationError),
92
    #[allow(dead_code)]
93
    UnexpectedStatusCode(http::StatusCode),
94
}
95

96
impl From<InternalFinalizeResponseError> for FinalizeResponseError {
NEW
97
    fn from(value: InternalFinalizeResponseError) -> Self { FinalizeResponseError(value) }
×
98
}
99

100
impl Display for FinalizeResponseError {
NEW
101
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) }
×
102
}
103

104
impl std::error::Error for FinalizeResponseError {
NEW
105
    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
×
NEW
106
        match &self.0 {
×
NEW
107
            InternalFinalizeResponseError::InvalidSize(_) => None,
×
NEW
108
            InternalFinalizeResponseError::Ohttp(e) => Some(e),
×
NEW
109
            InternalFinalizeResponseError::UnexpectedStatusCode(_) => None,
×
110
        }
NEW
111
    }
×
112
}
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