mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Expose channel_type
in Event::ChannelPending
It is useful to immediately know what kind of channel is being opened, and not having to wait until `ChannelReady`.
This commit is contained in:
parent
7c9463668a
commit
2e61d92044
2 changed files with 14 additions and 2 deletions
|
@ -845,6 +845,10 @@ pub enum Event {
|
||||||
counterparty_node_id: PublicKey,
|
counterparty_node_id: PublicKey,
|
||||||
/// The outpoint of the channel's funding transaction.
|
/// The outpoint of the channel's funding transaction.
|
||||||
funding_txo: OutPoint,
|
funding_txo: OutPoint,
|
||||||
|
/// The features that this channel will operate with.
|
||||||
|
///
|
||||||
|
/// Will be `None` for channels created prior to LDK version 0.0.122.
|
||||||
|
channel_type: Option<ChannelTypeFeatures>,
|
||||||
},
|
},
|
||||||
/// Used to indicate that a channel with the given `channel_id` is ready to
|
/// Used to indicate that a channel with the given `channel_id` is ready to
|
||||||
/// be used. This event is emitted either when the funding transaction has been confirmed
|
/// be used. This event is emitted either when the funding transaction has been confirmed
|
||||||
|
@ -1214,10 +1218,14 @@ impl Writeable for Event {
|
||||||
(6, channel_type, required),
|
(6, channel_type, required),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
&Event::ChannelPending { ref channel_id, ref user_channel_id, ref former_temporary_channel_id, ref counterparty_node_id, ref funding_txo } => {
|
&Event::ChannelPending { ref channel_id, ref user_channel_id,
|
||||||
|
ref former_temporary_channel_id, ref counterparty_node_id, ref funding_txo,
|
||||||
|
ref channel_type
|
||||||
|
} => {
|
||||||
31u8.write(writer)?;
|
31u8.write(writer)?;
|
||||||
write_tlv_fields!(writer, {
|
write_tlv_fields!(writer, {
|
||||||
(0, channel_id, required),
|
(0, channel_id, required),
|
||||||
|
(1, channel_type, option),
|
||||||
(2, user_channel_id, required),
|
(2, user_channel_id, required),
|
||||||
(4, former_temporary_channel_id, required),
|
(4, former_temporary_channel_id, required),
|
||||||
(6, counterparty_node_id, required),
|
(6, counterparty_node_id, required),
|
||||||
|
@ -1606,8 +1614,10 @@ impl MaybeReadable for Event {
|
||||||
let mut former_temporary_channel_id = None;
|
let mut former_temporary_channel_id = None;
|
||||||
let mut counterparty_node_id = RequiredWrapper(None);
|
let mut counterparty_node_id = RequiredWrapper(None);
|
||||||
let mut funding_txo = RequiredWrapper(None);
|
let mut funding_txo = RequiredWrapper(None);
|
||||||
|
let mut channel_type = None;
|
||||||
read_tlv_fields!(reader, {
|
read_tlv_fields!(reader, {
|
||||||
(0, channel_id, required),
|
(0, channel_id, required),
|
||||||
|
(1, channel_type, option),
|
||||||
(2, user_channel_id, required),
|
(2, user_channel_id, required),
|
||||||
(4, former_temporary_channel_id, required),
|
(4, former_temporary_channel_id, required),
|
||||||
(6, counterparty_node_id, required),
|
(6, counterparty_node_id, required),
|
||||||
|
@ -1619,7 +1629,8 @@ impl MaybeReadable for Event {
|
||||||
user_channel_id,
|
user_channel_id,
|
||||||
former_temporary_channel_id,
|
former_temporary_channel_id,
|
||||||
counterparty_node_id: counterparty_node_id.0.unwrap(),
|
counterparty_node_id: counterparty_node_id.0.unwrap(),
|
||||||
funding_txo: funding_txo.0.unwrap()
|
funding_txo: funding_txo.0.unwrap(),
|
||||||
|
channel_type,
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
f()
|
f()
|
||||||
|
|
|
@ -2152,6 +2152,7 @@ macro_rules! emit_channel_pending_event {
|
||||||
counterparty_node_id: $channel.context.get_counterparty_node_id(),
|
counterparty_node_id: $channel.context.get_counterparty_node_id(),
|
||||||
user_channel_id: $channel.context.get_user_id(),
|
user_channel_id: $channel.context.get_user_id(),
|
||||||
funding_txo: $channel.context.get_funding_txo().unwrap().into_bitcoin_outpoint(),
|
funding_txo: $channel.context.get_funding_txo().unwrap().into_bitcoin_outpoint(),
|
||||||
|
channel_type: Some($channel.context.get_channel_type().clone()),
|
||||||
}, None));
|
}, None));
|
||||||
$channel.context.set_channel_pending_event_emitted();
|
$channel.context.set_channel_pending_event_emitted();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue