use bitcoin::secp256k1::schnorr;
use bitcoin::secp256k1::{self, PublicKey, Scalar, Secp256k1, SecretKey};
-use lightning::blinded_path::message::{BlindedMessagePath, MessageContext, OffersContext};
+use lightning::blinded_path::message::{
+ AsyncPaymentsContext, BlindedMessagePath, MessageContext, OffersContext,
+};
use lightning::blinded_path::EmptyNodeIdLookUp;
use lightning::ln::features::InitFeatures;
use lightning::ln::msgs::{self, DecodeError, OnionMessageHandler};
responder.respond(),
))
}
- fn release_held_htlc(&self, _message: ReleaseHeldHtlc) {}
+ fn release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {}
}
#[derive(Debug)]
use bitcoin::{secp256k1, Sequence};
use crate::events::FundingInfo;
-use crate::blinded_path::message::{MessageContext, OffersContext};
+use crate::blinded_path::message::{AsyncPaymentsContext, MessageContext, OffersContext};
use crate::blinded_path::NodeIdLookUp;
use crate::blinded_path::message::{BlindedMessagePath, MessageForwardNode};
use crate::blinded_path::payment::{BlindedPaymentPath, Bolt12OfferContext, Bolt12RefundContext, PaymentConstraints, PaymentContext, ReceiveTlvs};
None
}
- fn release_held_htlc(&self, _message: ReleaseHeldHtlc) {}
+ fn release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {}
fn release_pending_messages(&self) -> Vec<(AsyncPaymentsMessage, MessageSendInstructions)> {
Vec::new()
use bitcoin::constants::ChainHash;
use bitcoin::secp256k1::{self, Secp256k1, SecretKey, PublicKey};
-use crate::blinded_path::message::OffersContext;
+use crate::blinded_path::message::{AsyncPaymentsContext, OffersContext};
use crate::sign::{NodeSigner, Recipient};
use crate::events::{MessageSendEvent, MessageSendEventsProvider};
use crate::ln::types::ChannelId;
) -> Option<(ReleaseHeldHtlc, ResponseInstruction)> {
None
}
- fn release_held_htlc(&self, _message: ReleaseHeldHtlc) {}
+ fn release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {}
}
impl CustomOnionMessageHandler for IgnoringMessageHandler {
type CustomMessage = Infallible;
//! Message handling for async payments.
+use crate::blinded_path::message::AsyncPaymentsContext;
use crate::io;
use crate::ln::msgs::DecodeError;
use crate::onion_message::messenger::{MessageSendInstructions, Responder, ResponseInstruction};
/// Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC
/// should be released to the corresponding payee.
- fn release_held_htlc(&self, message: ReleaseHeldHtlc);
+ fn release_held_htlc(&self, message: ReleaseHeldHtlc, context: AsyncPaymentsContext);
/// Release any [`AsyncPaymentsMessage`]s that need to be sent.
///
//! Onion message testing and test utilities live here.
use crate::blinded_path::EmptyNodeIdLookUp;
-use crate::blinded_path::message::{BlindedMessagePath, MessageForwardNode, MessageContext, OffersContext};
+use crate::blinded_path::message::{AsyncPaymentsContext, BlindedMessagePath, MessageForwardNode, MessageContext, OffersContext};
use crate::events::{Event, EventsProvider};
use crate::ln::features::{ChannelFeatures, InitFeatures};
use crate::ln::msgs::{self, DecodeError, OnionMessageHandler};
) -> Option<(ReleaseHeldHtlc, ResponseInstruction)> {
None
}
- fn release_held_htlc(&self, _message: ReleaseHeldHtlc) {}
+ fn release_held_htlc(&self, _message: ReleaseHeldHtlc, _context: AsyncPaymentsContext) {}
}
#[derive(Clone, Debug, PartialEq)]
},
#[cfg(async_payments)]
ParsedOnionMessageContents::AsyncPayments(AsyncPaymentsMessage::ReleaseHeldHtlc(msg)) => {
- self.async_payments_handler.release_held_htlc(msg);
+ let context = match context {
+ Some(MessageContext::AsyncPayments(context)) => context,
+ Some(_) => {
+ debug_assert!(false, "Checked in peel_onion_message");
+ return
+ },
+ None => return,
+ };
+ self.async_payments_handler.release_held_htlc(msg, context);
},
ParsedOnionMessageContents::Custom(msg) => {
let context = match context {