@@ -40,7 +40,7 @@ use crate::events::{Event, EventHandler, EventsProvider, MessageSendEvent, Messa
40
40
// Since this struct is returned in `list_channels` methods, expose it here in case users want to
41
41
// construct one themselves.
42
42
use crate::ln::{inbound_payment, PaymentHash, PaymentPreimage, PaymentSecret};
43
- use crate::ln::channel::{Channel, ChannelContext, ChannelError, ChannelUpdateStatus, ShutdownResult, UnfundedChannelContext, UpdateFulfillCommitFetch, OutboundV1Channel, InboundV1Channel, UnacceptedInboundV1Channel };
43
+ use crate::ln::channel::{Channel, ChannelContext, ChannelError, ChannelUpdateStatus, ShutdownResult, UnfundedChannelContext, UpdateFulfillCommitFetch, OutboundV1Channel, InboundChannelRequest, InboundV1Channel };
44
44
use crate::ln::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures};
45
45
#[cfg(any(feature = "_test_utils", test))]
46
46
use crate::ln::features::Bolt11InvoiceFeatures;
@@ -638,7 +638,7 @@ pub(super) struct PeerState<Signer: ChannelSigner> {
638
638
/// `temporary_channel_id` -> `UnacceptedInboundV1Channel`.
639
639
///
640
640
/// Holds all unaccepted inbound V1 channels where the peer is the counterparty.
641
- pub(super) unaccepted_inbound_v1_channel_by_id : HashMap<[u8; 32], UnacceptedInboundV1Channel >,
641
+ pub(super) inbound_channel_request_by_id : HashMap<[u8; 32], InboundChannelRequest >,
642
642
/// The latest `InitFeatures` we heard from the peer.
643
643
latest_features: InitFeatures,
644
644
/// Messages to send to the peer - pushed to in the same lock that they are generated in (except
@@ -694,7 +694,7 @@ impl <Signer: ChannelSigner> PeerState<Signer> {
694
694
self.channel_by_id.len() +
695
695
self.outbound_v1_channel_by_id.len() +
696
696
self.inbound_v1_channel_by_id.len() +
697
- self.unaccepted_inbound_v1_channel_by_id .len()
697
+ self.inbound_channel_request_by_id .len()
698
698
}
699
699
700
700
// Returns a bool indicating if the given `channel_id` matches a channel we have with this peer.
@@ -2564,7 +2564,7 @@ where
2564
2564
self.finish_force_close_channel(chan.context.force_shutdown(false));
2565
2565
// Unfunded channel has no update
2566
2566
(None, chan.context.get_counterparty_node_id())
2567
- } else if let Some(chan) = peer_state.unaccepted_inbound_v1_channel_by_id .remove(channel_id) {
2567
+ } else if let Some(chan) = peer_state.inbound_channel_request_by_id .remove(channel_id) {
2568
2568
log_error!(self.logger, "Force-closing channel {}", log_bytes!(channel_id[..]));
2569
2569
// N.B. that we don't send any channel close event here: we
2570
2570
// don't have a user_channel_id, and we never sent any opening
@@ -5190,7 +5190,7 @@ where
5190
5190
5191
5191
// Find (and remove) the channel in the unaccepted table. If it's
5192
5192
// not there, something weird is happening and return an error.
5193
- let mut channel = match peer_state.unaccepted_inbound_v1_channel_by_id .remove(temporary_channel_id) {
5193
+ let mut channel = match peer_state.inbound_channel_request_by_id .remove(temporary_channel_id) {
5194
5194
Some(unaccepted_channel) => {
5195
5195
let best_block_height = self.best_block.read().unwrap().height();
5196
5196
InboundV1Channel::new(&self.fee_estimator, &self.entropy_source, &self.signer_provider,
@@ -5279,7 +5279,7 @@ where
5279
5279
num_unfunded_channels += 1;
5280
5280
}
5281
5281
}
5282
- num_unfunded_channels + peer.unaccepted_inbound_v1_channel_by_id .len()
5282
+ num_unfunded_channels + peer.inbound_channel_request_by_id .len()
5283
5283
}
5284
5284
5285
5285
fn internal_open_channel(&self, counterparty_node_id: &PublicKey, msg: &msgs::OpenChannel) -> Result<(), MsgHandleErrInternal> {
@@ -5347,7 +5347,7 @@ where
5347
5347
push_msat: msg.push_msat,
5348
5348
channel_type: msg.channel_type.clone().unwrap(),
5349
5349
}, None));
5350
- peer_state.unaccepted_inbound_v1_channel_by_id .insert(channel_id, UnacceptedInboundV1Channel {
5350
+ peer_state.inbound_channel_request_by_id .insert(channel_id, InboundChannelRequest {
5351
5351
counterparty_node_id: *counterparty_node_id,
5352
5352
open_channel_msg: msg.clone(),
5353
5353
outbound_scid_alias: outbound_scid_alias,
@@ -7293,7 +7293,7 @@ where
7293
7293
channel_by_id: HashMap::new(),
7294
7294
outbound_v1_channel_by_id: HashMap::new(),
7295
7295
inbound_v1_channel_by_id: HashMap::new(),
7296
- unaccepted_inbound_v1_channel_by_id : HashMap::new(),
7296
+ inbound_channel_request_by_id : HashMap::new(),
7297
7297
latest_features: init_msg.features.clone(),
7298
7298
pending_msg_events: Vec::new(),
7299
7299
in_flight_monitor_updates: BTreeMap::new(),
@@ -8488,7 +8488,7 @@ where
8488
8488
channel_by_id,
8489
8489
outbound_v1_channel_by_id: HashMap::new(),
8490
8490
inbound_v1_channel_by_id: HashMap::new(),
8491
- unaccepted_inbound_v1_channel_by_id : HashMap::new(),
8491
+ inbound_channel_request_by_id : HashMap::new(),
8492
8492
latest_features: InitFeatures::empty(),
8493
8493
pending_msg_events: Vec::new(),
8494
8494
in_flight_monitor_updates: BTreeMap::new(),
@@ -10210,8 +10210,9 @@ mod tests {
10210
10210
let open_channel_msg = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
10211
10211
assert!(!open_channel_msg.channel_type.unwrap().supports_anchors_zero_fee_htlc_tx());
10212
10212
10213
- // Since we never created a InboundV1Channel object, we cannot generate close event.
10214
- //check_closed_event!(nodes[1], 1, ClosureReason::HolderForceClosed);
10213
+ // Since nodes[1] should not have accepted the channel, it should
10214
+ // not have generated any events.
10215
+ assert!(nodes[1].node.get_and_clear_pending_events().is_empty());
10215
10216
}
10216
10217
10217
10218
#[test]
0 commit comments