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

payjoin / rust-payjoin / 14478839957

15 Apr 2025 08:32PM UTC coverage: 82.006% (+0.2%) from 81.794%
14478839957

Pull #642

github

web-flow
Merge 8e6994122 into 361c31e56
Pull Request #642: Duplicate proposals catch in ns1r

80 of 85 new or added lines in 3 files covered. (94.12%)

27 existing lines in 3 files now uncovered.

5396 of 6580 relevant lines covered (82.01%)

702.82 hits per line

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

25.0
/payjoin/src/receive/multiparty/error.rs
1
use core::fmt;
2
use std::error;
3

4
#[derive(Debug)]
5
pub struct MultipartyError(InternalMultipartyError);
6

7
#[derive(Debug)]
8
pub(crate) enum InternalMultipartyError {
9
    /// Not enough proposals
10
    NotEnoughProposals,
11
    /// Identical participants
12
    IdenticalProposals,
13
    /// Proposal version not supported
14
    ProposalVersionNotSupported(usize),
15
    /// Optimistic merge not supported
16
    OptimisticMergeNotSupported,
17
    /// Bitcoin Internal Error
18
    BitcoinExtractTxError(Box<bitcoin::psbt::ExtractTxError>),
19
    /// Input in Finalized Proposal is missing witness or script_sig
20
    InputMissingWitnessOrScriptSig,
21
    /// Failed to combine psbts
22
    FailedToCombinePsbts(bitcoin::psbt::Error),
23
}
24

25
impl From<InternalMultipartyError> for MultipartyError {
26
    fn from(e: InternalMultipartyError) -> Self { MultipartyError(e) }
6✔
27
}
28

29
impl fmt::Display for MultipartyError {
30
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6✔
31
        match &self.0 {
6✔
32
            InternalMultipartyError::NotEnoughProposals => write!(f, "Not enough proposals"),
2✔
33
            InternalMultipartyError::IdenticalProposals =>
34
                write!(f, "More than one identical participant"),
4✔
35
            InternalMultipartyError::ProposalVersionNotSupported(v) =>
×
36
                write!(f, "Proposal version not supported: {}", v),
×
37
            InternalMultipartyError::OptimisticMergeNotSupported =>
38
                write!(f, "Optimistic merge not supported"),
×
39
            InternalMultipartyError::BitcoinExtractTxError(e) =>
×
40
                write!(f, "Bitcoin extract tx error: {:?}", e),
×
41
            InternalMultipartyError::InputMissingWitnessOrScriptSig =>
42
                write!(f, "Input in Finalized Proposal is missing witness or script_sig"),
×
43
            InternalMultipartyError::FailedToCombinePsbts(e) =>
×
44
                write!(f, "Failed to combine psbts: {:?}", e),
×
45
        }
46
    }
6✔
47
}
48

49
impl error::Error for MultipartyError {
UNCOV
50
    fn source(&self) -> Option<&(dyn error::Error + 'static)> {
×
UNCOV
51
        match &self.0 {
×
UNCOV
52
            InternalMultipartyError::NotEnoughProposals => None,
×
NEW
53
            InternalMultipartyError::IdenticalProposals => None,
×
54
            InternalMultipartyError::ProposalVersionNotSupported(_) => None,
×
55
            InternalMultipartyError::OptimisticMergeNotSupported => None,
×
56
            InternalMultipartyError::BitcoinExtractTxError(e) => Some(e),
×
57
            InternalMultipartyError::InputMissingWitnessOrScriptSig => None,
×
58
            InternalMultipartyError::FailedToCombinePsbts(e) => Some(e),
×
59
        }
UNCOV
60
    }
×
61
}
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