//! few other things.
use ln::msgs;
-use ln::channelmanager::{PaymentPreimage, PaymentHash};
+use ln::channelmanager::{PaymentPreimage, PaymentHash, PaymentSecret};
use chain::transaction::OutPoint;
use chain::keysinterface::SpendableOutputDescriptor;
use util::ser::{Writeable, Writer, MaybeReadable, Readable};
PaymentReceived {
/// The hash for which the preimage should be handed to the ChannelManager.
payment_hash: PaymentHash,
+ /// The "payment secret". This authenticates the sender to the recipient, preventing a
+ /// number of deanonymization attacks during the routing process.
+ /// As nodes upgrade, the invoices you provide should likely migrate to setting the
+ /// payment_secret feature to required, at which point you should fail_backwards any HTLCs
+ /// which have a None here.
+ /// Until then, however, values of None should be ignored, and only incorrect Some values
+ /// should result in an HTLC fail_backwards.
+ /// Note that, in any case, this value must be passed as-is to any fail or claim calls as
+ /// the HTLC index includes this value.
+ payment_secret: Option<PaymentSecret>,
/// The value, in thousandths of a satoshi, that this payment is for. Note that you must
/// compare this to the expected value before accepting the payment (as otherwise you are
/// providing proof-of-payment for less than the value you expected!).
funding_txo.write(writer)?;
user_channel_id.write(writer)?;
},
- &Event::PaymentReceived { ref payment_hash, ref amt } => {
+ &Event::PaymentReceived { ref payment_hash, ref payment_secret, ref amt } => {
2u8.write(writer)?;
payment_hash.write(writer)?;
+ payment_secret.write(writer)?;
amt.write(writer)?;
},
&Event::PaymentSent { ref payment_preimage } => {
Ok(())
}
}
-impl<R: ::std::io::Read> MaybeReadable<R> for Event {
- fn read(reader: &mut R) -> Result<Option<Self>, msgs::DecodeError> {
+impl MaybeReadable for Event {
+ fn read<R: ::std::io::Read>(reader: &mut R) -> Result<Option<Self>, msgs::DecodeError> {
match Readable::read(reader)? {
0u8 => Ok(None),
1u8 => Ok(Some(Event::FundingBroadcastSafe {
})),
2u8 => Ok(Some(Event::PaymentReceived {
payment_hash: Readable::read(reader)?,
+ payment_secret: Readable::read(reader)?,
amt: Readable::read(reader)?,
})),
3u8 => Ok(Some(Event::PaymentSent {
},
/// Used to indicate that a channel_announcement and channel_update should be broadcast to all
/// peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
+ ///
+ /// Note that after doing so, you very likely (unless you did so very recently) want to call
+ /// ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
+ /// This ensures that any nodes which see our channel_announcement also have a relevant
+ /// node_announcement, including relevant feature flags which may be important for routing
+ /// through or to us.
BroadcastChannelAnnouncement {
/// The channel_announcement which should be sent.
msg: msgs::ChannelAnnouncement,
/// The followup channel_update which should be sent.
update_msg: msgs::ChannelUpdate,
},
+ /// Used to indicate that a node_announcement should be broadcast to all peers.
+ BroadcastNodeAnnouncement {
+ /// The node_announcement which should be sent.
+ msg: msgs::NodeAnnouncement,
+ },
/// Used to indicate that a channel_update should be broadcast to all peers.
BroadcastChannelUpdate {
/// The channel_update which should be sent.