@@ -23,7 +23,7 @@ use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields};
23
23
use crate :: ln:: channel:: FUNDING_CONF_DEADLINE_BLOCKS ;
24
24
use crate :: ln:: features:: ChannelTypeFeatures ;
25
25
use crate :: ln:: msgs;
26
- use crate :: ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
26
+ use crate :: ln:: { ChannelId , PaymentPreimage , PaymentHash , PaymentSecret } ;
27
27
use crate :: routing:: gossip:: NetworkUpdate ;
28
28
use crate :: util:: errors:: APIError ;
29
29
use crate :: util:: ser:: { BigSize , FixedLengthReader , Writeable , Writer , MaybeReadable , Readable , RequiredWrapper , UpgradableRequired , WithoutLength } ;
@@ -83,7 +83,7 @@ impl_writeable_tlv_based_enum!(PaymentPurpose,
83
83
#[ derive( Clone , Debug , PartialEq , Eq ) ]
84
84
pub struct ClaimedHTLC {
85
85
/// The `channel_id` of the channel over which the HTLC was received.
86
- pub channel_id : [ u8 ; 32 ] ,
86
+ pub channel_id : ChannelId ,
87
87
/// The `user_channel_id` of the channel over which the HTLC was received. This is the value
88
88
/// passed in to [`ChannelManager::create_channel`] for outbound channels, or to
89
89
/// [`ChannelManager::accept_inbound_channel`] for inbound channels if
@@ -246,7 +246,7 @@ pub enum HTLCDestination {
246
246
/// counterparty node information.
247
247
node_id : Option < PublicKey > ,
248
248
/// The outgoing `channel_id` between us and the next node.
249
- channel_id : [ u8 ; 32 ] ,
249
+ channel_id : ChannelId ,
250
250
} ,
251
251
/// Scenario where we are unsure of the next node to forward the HTLC to.
252
252
UnknownNextHop {
@@ -364,7 +364,7 @@ pub enum Event {
364
364
/// [`ChannelManager::funding_transaction_generated`].
365
365
///
366
366
/// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
367
- temporary_channel_id : [ u8 ; 32 ] ,
367
+ temporary_channel_id : ChannelId ,
368
368
/// The counterparty's node_id, which you'll need to pass back into
369
369
/// [`ChannelManager::funding_transaction_generated`].
370
370
///
@@ -458,7 +458,7 @@ pub enum Event {
458
458
/// payment is to pay an invoice or to send a spontaneous payment.
459
459
purpose : PaymentPurpose ,
460
460
/// The `channel_id` indicating over which channel we received the payment.
461
- via_channel_id : Option < [ u8 ; 32 ] > ,
461
+ via_channel_id : Option < ChannelId > ,
462
462
/// The `user_channel_id` indicating over which channel we received the payment.
463
463
via_user_channel_id : Option < u128 > ,
464
464
/// The block height at which this payment will be failed back and will no longer be
@@ -718,17 +718,17 @@ pub enum Event {
718
718
/// The `channel_id` indicating which channel the spendable outputs belong to.
719
719
///
720
720
/// This will always be `Some` for events generated by LDK versions 0.0.117 and above.
721
- channel_id : Option < [ u8 ; 32 ] > ,
721
+ channel_id : Option < ChannelId > ,
722
722
} ,
723
723
/// This event is generated when a payment has been successfully forwarded through us and a
724
724
/// forwarding fee earned.
725
725
PaymentForwarded {
726
726
/// The incoming channel between the previous node and us. This is only `None` for events
727
727
/// generated or serialized by versions prior to 0.0.107.
728
- prev_channel_id : Option < [ u8 ; 32 ] > ,
728
+ prev_channel_id : Option < ChannelId > ,
729
729
/// The outgoing channel between the next node and us. This is only `None` for events
730
730
/// generated or serialized by versions prior to 0.0.107.
731
- next_channel_id : Option < [ u8 ; 32 ] > ,
731
+ next_channel_id : Option < ChannelId > ,
732
732
/// The fee, in milli-satoshis, which was earned as a result of the payment.
733
733
///
734
734
/// Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
@@ -759,7 +759,7 @@ pub enum Event {
759
759
/// [`Event::ChannelReady`] event.
760
760
ChannelPending {
761
761
/// The `channel_id` of the channel that is pending confirmation.
762
- channel_id : [ u8 ; 32 ] ,
762
+ channel_id : ChannelId ,
763
763
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
764
764
/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
765
765
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
@@ -772,7 +772,7 @@ pub enum Event {
772
772
/// The `temporary_channel_id` this channel used to be known by during channel establishment.
773
773
///
774
774
/// Will be `None` for channels created prior to LDK version 0.0.115.
775
- former_temporary_channel_id : Option < [ u8 ; 32 ] > ,
775
+ former_temporary_channel_id : Option < ChannelId > ,
776
776
/// The `node_id` of the channel counterparty.
777
777
counterparty_node_id : PublicKey ,
778
778
/// The outpoint of the channel's funding transaction.
@@ -784,7 +784,7 @@ pub enum Event {
784
784
/// establishment.
785
785
ChannelReady {
786
786
/// The `channel_id` of the channel that is ready.
787
- channel_id : [ u8 ; 32 ] ,
787
+ channel_id : ChannelId ,
788
788
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
789
789
/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
790
790
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
@@ -811,7 +811,7 @@ pub enum Event {
811
811
ChannelClosed {
812
812
/// The `channel_id` of the channel which has been closed. Note that on-chain transactions
813
813
/// resolving the channel are likely still awaiting confirmation.
814
- channel_id : [ u8 ; 32 ] ,
814
+ channel_id : ChannelId ,
815
815
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
816
816
/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
817
817
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
@@ -838,7 +838,7 @@ pub enum Event {
838
838
/// inputs for another purpose.
839
839
DiscardFunding {
840
840
/// The channel_id of the channel which has been closed.
841
- channel_id : [ u8 ; 32 ] ,
841
+ channel_id : ChannelId ,
842
842
/// The full transaction received from the user
843
843
transaction : Transaction
844
844
} ,
@@ -863,7 +863,7 @@ pub enum Event {
863
863
///
864
864
/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
865
865
/// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
866
- temporary_channel_id : [ u8 ; 32 ] ,
866
+ temporary_channel_id : ChannelId ,
867
867
/// The node_id of the counterparty requesting to open the channel.
868
868
///
869
869
/// When responding to the request, the `counterparty_node_id` should be passed
@@ -909,7 +909,7 @@ pub enum Event {
909
909
/// requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
910
910
HTLCHandlingFailed {
911
911
/// The channel over which the HTLC was received.
912
- prev_channel_id : [ u8 ; 32 ] ,
912
+ prev_channel_id : ChannelId ,
913
913
/// Destination of the HTLC that failed to be processed.
914
914
failed_next_destination : HTLCDestination ,
915
915
} ,
@@ -1279,7 +1279,7 @@ impl MaybeReadable for Event {
1279
1279
5u8 => {
1280
1280
let f = || {
1281
1281
let mut outputs = WithoutLength ( Vec :: new ( ) ) ;
1282
- let mut channel_id: Option < [ u8 ; 32 ] > = None ;
1282
+ let mut channel_id: Option < ChannelId > = None ;
1283
1283
read_tlv_fields ! ( reader, {
1284
1284
( 0 , outputs, required) ,
1285
1285
( 1 , channel_id, option) ,
@@ -1335,7 +1335,7 @@ impl MaybeReadable for Event {
1335
1335
} ,
1336
1336
9u8 => {
1337
1337
let f = || {
1338
- let mut channel_id = [ 0 ; 32 ] ;
1338
+ let mut channel_id = ChannelId :: new_zero ( ) ;
1339
1339
let mut reason = UpgradableRequired ( None ) ;
1340
1340
let mut user_channel_id_low_opt: Option < u64 > = None ;
1341
1341
let mut user_channel_id_high_opt: Option < u64 > = None ;
@@ -1363,7 +1363,7 @@ impl MaybeReadable for Event {
1363
1363
} ,
1364
1364
11u8 => {
1365
1365
let f = || {
1366
- let mut channel_id = [ 0 ; 32 ] ;
1366
+ let mut channel_id = ChannelId :: new_zero ( ) ;
1367
1367
let mut transaction = Transaction { version : 2 , lock_time : PackedLockTime :: ZERO , input : Vec :: new ( ) , output : Vec :: new ( ) } ;
1368
1368
read_tlv_fields ! ( reader, {
1369
1369
( 0 , channel_id, required) ,
@@ -1474,7 +1474,7 @@ impl MaybeReadable for Event {
1474
1474
} ,
1475
1475
25u8 => {
1476
1476
let f = || {
1477
- let mut prev_channel_id = [ 0 ; 32 ] ;
1477
+ let mut prev_channel_id = ChannelId :: new_zero ( ) ;
1478
1478
let mut failed_next_destination_opt = UpgradableRequired ( None ) ;
1479
1479
read_tlv_fields ! ( reader, {
1480
1480
( 0 , prev_channel_id, required) ,
@@ -1490,7 +1490,7 @@ impl MaybeReadable for Event {
1490
1490
27u8 => Ok ( None ) ,
1491
1491
29u8 => {
1492
1492
let f = || {
1493
- let mut channel_id = [ 0 ; 32 ] ;
1493
+ let mut channel_id = ChannelId :: new_zero ( ) ;
1494
1494
let mut user_channel_id: u128 = 0 ;
1495
1495
let mut counterparty_node_id = RequiredWrapper ( None ) ;
1496
1496
let mut channel_type = RequiredWrapper ( None ) ;
@@ -1512,7 +1512,7 @@ impl MaybeReadable for Event {
1512
1512
} ,
1513
1513
31u8 => {
1514
1514
let f = || {
1515
- let mut channel_id = [ 0 ; 32 ] ;
1515
+ let mut channel_id = ChannelId :: new_zero ( ) ;
1516
1516
let mut user_channel_id: u128 = 0 ;
1517
1517
let mut former_temporary_channel_id = None ;
1518
1518
let mut counterparty_node_id = RequiredWrapper ( None ) ;
0 commit comments