use crate::offers::refund::{Refund, RefundBuilder};
use crate::offers::signer;
use crate::onion_message::async_payments::{AsyncPaymentsMessage, HeldHtlcAvailable, ReleaseHeldHtlc, AsyncPaymentsMessageHandler};
-use crate::onion_message::messenger::{Destination, MessageRouter, PendingOnionMessage, Responder, ResponseInstruction, MessageSendInstructions};
+use crate::onion_message::messenger::{Destination, MessageRouter, Responder, ResponseInstruction, MessageSendInstructions};
use crate::onion_message::offers::{OffersMessage, OffersMessageHandler};
use crate::sign::{EntropySource, NodeSigner, Recipient, SignerProvider};
use crate::sign::ecdsa::EcdsaChannelSigner;
fn release_held_htlc(&self, _message: ReleaseHeldHtlc) {}
- fn release_pending_messages(&self) -> Vec<PendingOnionMessage<AsyncPaymentsMessage>> {
+ fn release_pending_messages(&self) -> Vec<(AsyncPaymentsMessage, MessageSendInstructions)> {
Vec::new()
}
}
use crate::io;
use crate::ln::msgs::DecodeError;
-#[cfg(not(c_bindings))]
-use crate::onion_message::messenger::PendingOnionMessage;
-use crate::onion_message::messenger::{Responder, ResponseInstruction};
+use crate::onion_message::messenger::{MessageSendInstructions, Responder, ResponseInstruction};
use crate::onion_message::packet::OnionMessageContents;
use crate::prelude::*;
use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer};
///
/// Typically, this is used for messages initiating an async payment flow rather than in response
/// to another message.
- #[cfg(not(c_bindings))]
- fn release_pending_messages(&self) -> Vec<PendingOnionMessage<AsyncPaymentsMessage>> {
- vec![]
- }
-
- /// Release any [`AsyncPaymentsMessage`]s that need to be sent.
- ///
- /// Typically, this is used for messages initiating a payment flow rather than in response to
- /// another message.
- #[cfg(c_bindings)]
- fn release_pending_messages(
- &self,
- ) -> Vec<(
- AsyncPaymentsMessage,
- crate::onion_message::messenger::Destination,
- Option<crate::blinded_path::message::BlindedMessagePath>,
- )> {
+ fn release_pending_messages(&self) -> Vec<(AsyncPaymentsMessage, MessageSendInstructions)> {
vec![]
}
}
}
}
-/// An [`OnionMessage`] for [`OnionMessenger`] to send.
-///
-/// These are obtained when released from [`OnionMessenger`]'s handlers after which they are
-/// enqueued for sending.
-#[cfg(not(c_bindings))]
-pub struct PendingOnionMessage<T: OnionMessageContents> {
- /// The message contents to send in an [`OnionMessage`].
- pub contents: T,
-
- /// The destination of the message.
- pub destination: Destination,
-
- /// A reply path to include in the [`OnionMessage`] for a response.
- pub reply_path: Option<BlindedMessagePath>,
-}
-
-#[cfg(c_bindings)]
-/// An [`OnionMessage`] for [`OnionMessenger`] to send.
-///
-/// These are obtained when released from [`OnionMessenger`]'s handlers after which they are
-/// enqueued for sending.
-pub type PendingOnionMessage<T> = (T, Destination, Option<BlindedMessagePath>);
-
-pub(crate) fn new_pending_onion_message<T: OnionMessageContents>(
- contents: T, destination: Destination, reply_path: Option<BlindedMessagePath>
-) -> PendingOnionMessage<T> {
- #[cfg(not(c_bindings))]
- return PendingOnionMessage { contents, destination, reply_path };
- #[cfg(c_bindings)]
- return (contents, destination, reply_path);
-}
-
/// A trait defining behavior for routing an [`OnionMessage`].
pub trait MessageRouter {
/// Returns a route for sending an [`OnionMessage`] to the given [`Destination`].