Struct payjoin::receive::UncheckedProposal

source ·
pub struct UncheckedProposal { /* private fields */ }
Expand description

The sender’s original PSBT and optional parameters

This type is used to process the request. It is returned by UncheckedProposal::from_request().

If you are implementing an interactive payment processor, you should get extract the original transaction with extract_tx_to_schedule_broadcast() and schedule, followed by checking that the transaction can be broadcast with check_broadcast_suitability. Otherwise it is safe to call assume_interactive_receive to proceed with validation.

Implementations§

source§

impl UncheckedProposal

source

pub fn from_request( body: impl Read, query: &str, headers: impl Headers ) -> Result<Self, RequestError>

source

pub fn extract_tx_to_schedule_broadcast(&self) -> Transaction

The Sender’s Original PSBT transaction

source

pub fn check_broadcast_suitability( self, min_fee_rate: Option<FeeRate>, can_broadcast: impl Fn(&Transaction) -> Result<bool, Error> ) -> Result<MaybeInputsOwned, Error>

Check that the Original PSBT can be broadcasted.

Receiver MUST check that the Original PSBT from the sender can be broadcast, i.e. testmempoolaccept bitcoind rpc returns { “allowed”: true,.. }.

Receiver can optionaly set a minimum feerate that will be enforced on the Original PSBT. This can be used to prevent probing attacks and make it easier to deal with high feerate environments.

Do this check if you generate bitcoin uri to receive Payjoin on sender request without manual human approval, like a payment processor. Such so called “non-interactive” receivers are otherwise vulnerable to probing attacks. If a sender can make requests at will, they can learn which bitcoin the receiver owns at no cost. Broadcasting the Original PSBT after some time in the failure case makes incurs sender cost and prevents probing.

Call this after checking downstream.

source

pub fn assume_interactive_receiver(self) -> MaybeInputsOwned

Call this method if the only way to initiate a Payjoin with this receiver requires manual intervention, as in most consumer wallets.

So-called “non-interactive” receivers, like payment processors, that allow arbitrary requests are otherwise vulnerable to probing attacks. Those receivers call extract_tx_to_check_broadcast() and attest_tested_and_scheduled_broadcast() after making those checks downstream.

Trait Implementations§

source§

impl Clone for UncheckedProposal

source§

fn clone(&self) -> UncheckedProposal

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UncheckedProposal

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more