Trait AsyncPaymentsMessageHandler

Source
pub trait AsyncPaymentsMessageHandler {
    // Required methods
    fn handle_held_htlc_available(
        &self,
        message: HeldHtlcAvailable,
        responder: Option<Responder>,
    ) -> Option<(ReleaseHeldHtlc, ResponseInstruction)>;
    fn handle_release_held_htlc(
        &self,
        message: ReleaseHeldHtlc,
        context: AsyncPaymentsContext,
    );

    // Provided method
    fn release_pending_messages(
        &self,
    ) -> Vec<(AsyncPaymentsMessage, MessageSendInstructions)> { ... }
}
Expand description

A handler for an OnionMessage containing an async payments message as its payload.

Required Methods§

Source

fn handle_held_htlc_available( &self, message: HeldHtlcAvailable, responder: Option<Responder>, ) -> Option<(ReleaseHeldHtlc, ResponseInstruction)>

Handle a HeldHtlcAvailable message. A ReleaseHeldHtlc should be returned to release the held funds.

Source

fn handle_release_held_htlc( &self, message: ReleaseHeldHtlc, context: AsyncPaymentsContext, )

Handle a ReleaseHeldHtlc message. If authentication of the message succeeds, an HTLC should be released to the corresponding payee.

Provided Methods§

Source

fn release_pending_messages( &self, ) -> Vec<(AsyncPaymentsMessage, MessageSendInstructions)>

Release any AsyncPaymentsMessages that need to be sent.

Typically, this is used for messages initiating an async payment flow rather than in response to another message.

Implementors§