Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions payjoin/src/core/receive/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,7 @@ mod tests {
.commit_inputs()
.calculate_psbt_context_with_fee_range(None, None)
.expect("Contributed inputs should allow for valid fee contributions");
let payjoin_proposal =
psbt_context.finalize_proposal(|_| Ok(processed_psbt.clone())).expect("Valid psbt");
let payjoin_proposal = psbt_context.finalize_proposal(&processed_psbt).expect("Valid psbt");

assert!(payjoin_proposal.xpub.is_empty());

Expand Down
5 changes: 5 additions & 0 deletions payjoin/src/core/receive/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{error, fmt};
use crate::error_codes::ErrorCode::{
self, NotEnoughMoney, OriginalPsbtRejected, Unavailable, VersionUnsupported,
};
use crate::ImplementationError;

/// The top-level error type for the payjoin receiver
#[derive(Debug)]
Expand All @@ -29,6 +30,10 @@ impl From<ProtocolError> for Error {
fn from(e: ProtocolError) -> Self { Error::Protocol(e) }
}

impl From<ImplementationError> for Error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this extends the public API, and since ImplementationError has some From impls (which arguably also shouldn't be there) effectively allows any &str or Box<dyn Error + Send + sync>) to be converted to an Error

@chavic IIRC you have been auditing and removing some of these to remove unintended pub functionality, thoughts?

fn from(e: ImplementationError) -> Self { Error::Implementation(e) }
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Expand Down
Loading
Loading