projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move the historical bucket tracker to 32 unequal sized buckets
[rust-lightning]
/
lightning
/
src
/
events
/
mod.rs
diff --git
a/lightning/src/events/mod.rs
b/lightning/src/events/mod.rs
index d0a7bc57a784f198c61a42b1955b5709649df6aa..36c0f20d2aed5d99f8183240d3332d67e0cd0130 100644
(file)
--- a/
lightning/src/events/mod.rs
+++ b/
lightning/src/events/mod.rs
@@
-715,6
+715,10
@@
pub enum Event {
SpendableOutputs {
/// The outputs which you should store as spendable by you.
outputs: Vec<SpendableOutputDescriptor>,
SpendableOutputs {
/// The outputs which you should store as spendable by you.
outputs: Vec<SpendableOutputDescriptor>,
+ /// The `channel_id` indicating which channel the spendable outputs belong to.
+ ///
+ /// This will always be `Some` for events generated by LDK versions 0.0.117 and above.
+ channel_id: Option<[u8; 32]>,
},
/// This event is generated when a payment has been successfully forwarded through us and a
/// forwarding fee earned.
},
/// This event is generated when a payment has been successfully forwarded through us and a
/// forwarding fee earned.
@@
-821,12
+825,12
@@
pub enum Event {
user_channel_id: u128,
/// The reason the channel was closed.
reason: ClosureReason,
user_channel_id: u128,
/// The reason the channel was closed.
reason: ClosureReason,
- /// Counterparty in the closed channel.
- ///
+ /// Counterparty in the closed channel.
+ ///
/// This field will be `None` for objects serialized prior to LDK 0.0.117.
counterparty_node_id: Option<PublicKey>,
/// This field will be `None` for objects serialized prior to LDK 0.0.117.
counterparty_node_id: Option<PublicKey>,
- /// Channel capacity of the closing channel (sats).
- ///
+ /// Channel capacity of the closing channel (sats).
+ ///
/// This field will be `None` for objects serialized prior to LDK 0.0.117.
channel_capacity_sats: Option<u64>,
},
/// This field will be `None` for objects serialized prior to LDK 0.0.117.
channel_capacity_sats: Option<u64>,
},
@@
-1000,10
+1004,11
@@
impl Writeable for Event {
// Note that we now ignore these on the read end as we'll re-generate them in
// ChannelManager, we write them here only for backwards compatibility.
},
// Note that we now ignore these on the read end as we'll re-generate them in
// ChannelManager, we write them here only for backwards compatibility.
},
- &Event::SpendableOutputs { ref outputs } => {
+ &Event::SpendableOutputs { ref outputs
, channel_id
} => {
5u8.write(writer)?;
write_tlv_fields!(writer, {
(0, WithoutLength(outputs), required),
5u8.write(writer)?;
write_tlv_fields!(writer, {
(0, WithoutLength(outputs), required),
+ (1, channel_id, option),
});
},
&Event::HTLCIntercepted { requested_next_hop_scid, payment_hash, inbound_amount_msat, expected_outbound_amount_msat, intercept_id } => {
});
},
&Event::HTLCIntercepted { requested_next_hop_scid, payment_hash, inbound_amount_msat, expected_outbound_amount_msat, intercept_id } => {
@@
-1030,8
+1035,8
@@
impl Writeable for Event {
(5, outbound_amount_forwarded_msat, option),
});
},
(5, outbound_amount_forwarded_msat, option),
});
},
- &Event::ChannelClosed { ref channel_id, ref user_channel_id, ref reason,
- ref counterparty_node_id, ref channel_capacity_sats
+ &Event::ChannelClosed { ref channel_id, ref user_channel_id, ref reason,
+ ref counterparty_node_id, ref channel_capacity_sats
} => {
9u8.write(writer)?;
// `user_channel_id` used to be a single u64 value. In order to remain backwards
} => {
9u8.write(writer)?;
// `user_channel_id` used to be a single u64 value. In order to remain backwards
@@
-1274,10
+1279,12
@@
impl MaybeReadable for Event {
5u8 => {
let f = || {
let mut outputs = WithoutLength(Vec::new());
5u8 => {
let f = || {
let mut outputs = WithoutLength(Vec::new());
+ let mut channel_id: Option<[u8; 32]> = None;
read_tlv_fields!(reader, {
(0, outputs, required),
read_tlv_fields!(reader, {
(0, outputs, required),
+ (1, channel_id, option),
});
});
- Ok(Some(Event::SpendableOutputs { outputs: outputs.0 }))
+ Ok(Some(Event::SpendableOutputs { outputs: outputs.0
, channel_id
}))
};
f()
},
};
f()
},
@@
-1368,7
+1375,7
@@
impl MaybeReadable for Event {
},
13u8 => {
let f = || {
},
13u8 => {
let f = || {
- _init_and_read_tlv_fields!(reader, {
+ _init_and_read_
len_prefixed_
tlv_fields!(reader, {
(0, payment_id, required),
(2, payment_hash, option),
(4, path, required_vec),
(0, payment_id, required),
(2, payment_hash, option),
(4, path, required_vec),
@@
-1433,7
+1440,7
@@
impl MaybeReadable for Event {
},
21u8 => {
let f = || {
},
21u8 => {
let f = || {
- _init_and_read_tlv_fields!(reader, {
+ _init_and_read_
len_prefixed_
tlv_fields!(reader, {
(0, payment_id, required),
(2, payment_hash, required),
(4, path, required_vec),
(0, payment_id, required),
(2, payment_hash, required),
(4, path, required_vec),
@@
-1449,7
+1456,7
@@
impl MaybeReadable for Event {
},
23u8 => {
let f = || {
},
23u8 => {
let f = || {
- _init_and_read_tlv_fields!(reader, {
+ _init_and_read_
len_prefixed_
tlv_fields!(reader, {
(0, payment_id, required),
(2, payment_hash, required),
(4, path, required_vec),
(0, payment_id, required),
(2, payment_hash, required),
(4, path, required_vec),
@@
-1551,6
+1558,7
@@
impl MaybeReadable for Event {
/// broadcast to most peers).
/// These events are handled by PeerManager::process_events if you are using a PeerManager.
#[derive(Clone, Debug)]
/// broadcast to most peers).
/// These events are handled by PeerManager::process_events if you are using a PeerManager.
#[derive(Clone, Debug)]
+#[cfg_attr(test, derive(PartialEq))]
pub enum MessageSendEvent {
/// Used to indicate that we've accepted a channel open and should send the accept_channel
/// message provided to the given peer.
pub enum MessageSendEvent {
/// Used to indicate that we've accepted a channel open and should send the accept_channel
/// message provided to the given peer.