/// now + 5*time_forwardable).
time_forwardable: Duration,
},
- /// Used to indicate that an output was generated on-chain which you should know how to spend.
+ /// Used to indicate that an output which you should know how to spend was confirmed on chain
+ /// and is now spendable.
/// Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
/// counterparty spending them due to some kind of timeout. Thus, you need to store them
/// somewhere and spend them when you create on-chain transactions.
&Event::PaymentReceived { ref payment_hash, ref payment_preimage, ref payment_secret, ref amt, ref user_payment_id } => {
1u8.write(writer)?;
write_tlv_fields!(writer, {
- (0, payment_hash),
- (2, payment_secret),
- (4, amt),
- (6, user_payment_id),
- }, {
- (8, payment_preimage),
+ (0, payment_hash, required),
+ (2, payment_secret, required),
+ (4, amt, required),
+ (6, user_payment_id, required),
+ (8, payment_preimage, option),
});
},
&Event::PaymentSent { ref payment_preimage } => {
2u8.write(writer)?;
write_tlv_fields!(writer, {
- (0, payment_preimage),
- }, {});
- payment_preimage.write(writer)?;
+ (0, payment_preimage, required),
+ });
},
&Event::PaymentFailed { ref payment_hash, ref rejected_by_dest,
#[cfg(test)]
#[cfg(test)]
error_data.write(writer)?;
write_tlv_fields!(writer, {
- (0, payment_hash),
- (2, rejected_by_dest),
- }, {});
+ (0, payment_hash, required),
+ (2, rejected_by_dest, required),
+ });
},
&Event::PendingHTLCsForwardable { time_forwardable: _ } => {
4u8.write(writer)?;
- write_tlv_fields!(writer, {}, {});
+ write_tlv_fields!(writer, {});
// We don't write the time_fordwardable out at all, as we presume when the user
// deserializes us at least that much time has elapsed.
},
&Event::SpendableOutputs { ref outputs } => {
5u8.write(writer)?;
write_tlv_fields!(writer, {
- (0, VecWriteWrapper(outputs)),
- }, {});
+ (0, VecWriteWrapper(outputs), required),
+ });
},
}
Ok(())
let mut amt = 0;
let mut user_payment_id = 0;
read_tlv_fields!(reader, {
- (0, payment_hash),
- (2, payment_secret),
- (4, amt),
- (6, user_payment_id),
- }, {
- (8, payment_preimage),
+ (0, payment_hash, required),
+ (2, payment_secret, required),
+ (4, amt, required),
+ (6, user_payment_id, required),
+ (8, payment_preimage, option),
});
Ok(Some(Event::PaymentReceived {
payment_hash,
let f = || {
let mut payment_preimage = PaymentPreimage([0; 32]);
read_tlv_fields!(reader, {
- (0, payment_preimage),
- }, {});
+ (0, payment_preimage, required),
+ });
Ok(Some(Event::PaymentSent {
payment_preimage,
}))
let mut payment_hash = PaymentHash([0; 32]);
let mut rejected_by_dest = false;
read_tlv_fields!(reader, {
- (0, payment_hash),
- (2, rejected_by_dest),
- }, {});
+ (0, payment_hash, required),
+ (2, rejected_by_dest, required),
+ });
Ok(Some(Event::PaymentFailed {
payment_hash,
rejected_by_dest,
},
4u8 => {
let f = || {
- read_tlv_fields!(reader, {}, {});
+ read_tlv_fields!(reader, {});
Ok(Some(Event::PendingHTLCsForwardable {
time_forwardable: Duration::from_secs(0)
}))
let f = || {
let mut outputs = VecReadWrapper(Vec::new());
read_tlv_fields!(reader, {
- (0, outputs),
- }, {});
+ (0, outputs, required),
+ });
Ok(Some(Event::SpendableOutputs { outputs: outputs.0 }))
};
f()
/// The channel_update which should be sent.
msg: msgs::ChannelUpdate,
},
+ /// Used to indicate that a channel_update should be sent to a single peer.
+ /// In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
+ /// private channel and we shouldn't be informing all of our peers of channel parameters.
+ SendChannelUpdate {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The channel_update which should be sent.
+ msg: msgs::ChannelUpdate,
+ },
/// Broadcast an error downstream to be handled
HandleError {
/// The node_id of the node which should receive this message