Skip to content

Commit de93337

Browse files
committed
Rename try_chan_phase_entry
Now that ChannelPhase has been renamed, drop phase from related identifiers.
1 parent 5e96573 commit de93337

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,7 +3058,7 @@ macro_rules! break_channel_entry {
30583058
}
30593059
}
30603060

3061-
macro_rules! try_chan_phase_entry {
3061+
macro_rules! try_channel_entry {
30623062
($self: ident, $peer_state: expr, $res: expr, $entry: expr) => {
30633063
match $res {
30643064
Ok(res) => res,
@@ -8022,7 +8022,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80228022
hash_map::Entry::Occupied(mut phase) => {
80238023
match phase.get_mut().as_unfunded_outbound_v1_mut() {
80248024
Some(chan) => {
8025-
try_chan_phase_entry!(self, peer_state, chan.accept_channel(msg, &self.default_configuration.channel_handshake_limits, &peer_state.latest_features), phase);
8025+
try_channel_entry!(self, peer_state, chan.accept_channel(msg, &self.default_configuration.channel_handshake_limits, &peer_state.latest_features), phase);
80268026
(chan.context.get_value_satoshis(), chan.context.get_funding_redeemscript().to_p2wsh(), chan.context.get_user_id())
80278027
},
80288028
None => {
@@ -8298,7 +8298,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
82988298
let (msg_send_event_opt, signing_session_opt) = match channel_phase.as_unfunded_v2_mut() {
82998299
Some(channel) => channel.tx_complete(msg)
83008300
.into_msg_send_event_or_signing_session(counterparty_node_id),
8301-
None => try_chan_phase_entry!(self, peer_state, Err(ChannelError::Close(
8301+
None => try_channel_entry!(self, peer_state, Err(ChannelError::Close(
83028302
(
83038303
"Got a tx_complete message with no interactive transaction construction expected or in-progress".into(),
83048304
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
@@ -8369,7 +8369,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
83698369
match channel_phase {
83708370
Some(chan) => {
83718371
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8372-
let (tx_signatures_opt, funding_tx_opt) = try_chan_phase_entry!(self, peer_state, chan.tx_signatures(msg, &&logger), chan_phase_entry);
8372+
let (tx_signatures_opt, funding_tx_opt) = try_channel_entry!(self, peer_state, chan.tx_signatures(msg, &&logger), chan_phase_entry);
83738373
if let Some(tx_signatures) = tx_signatures_opt {
83748374
peer_state.pending_msg_events.push(events::MessageSendEvent::SendTxSignatures {
83758375
node_id: *counterparty_node_id,
@@ -8384,7 +8384,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
83848384
}
83858385
}
83868386
},
8387-
None => try_chan_phase_entry!(self, peer_state, Err(ChannelError::Close(
8387+
None => try_channel_entry!(self, peer_state, Err(ChannelError::Close(
83888388
(
83898389
"Got an unexpected tx_signatures message".into(),
83908390
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
@@ -8420,13 +8420,13 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
84208420
// for a "Channel::Funded" when we want to bump the fee on an interactively
84218421
// constructed funding tx or during splicing. For now we send an error as we would
84228422
// never ack an RBF attempt or a splice for now:
8423-
try_chan_phase_entry!(self, peer_state, Err(ChannelError::Warn(
8423+
try_channel_entry!(self, peer_state, Err(ChannelError::Warn(
84248424
"Got an unexpected tx_abort message: After initial funding transaction is signed, \
84258425
splicing and RBF attempts of interactive funding transactions are not supported yet so \
84268426
we don't have any negotiation in progress".into(),
84278427
)), chan_phase_entry)
84288428
} else {
8429-
try_chan_phase_entry!(self, peer_state, Err(ChannelError::Warn(
8429+
try_channel_entry!(self, peer_state, Err(ChannelError::Warn(
84308430
"Got an unexpected tx_abort message: This is an unfunded channel created with V1 channel \
84318431
establishment".into(),
84328432
)), chan_phase_entry)
@@ -8476,7 +8476,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
84768476
hash_map::Entry::Occupied(mut chan_phase_entry) => {
84778477
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
84788478
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8479-
let announcement_sigs_opt = try_chan_phase_entry!(self, peer_state, chan.channel_ready(&msg, &self.node_signer,
8479+
let announcement_sigs_opt = try_channel_entry!(self, peer_state, chan.channel_ready(&msg, &self.node_signer,
84808480
self.chain_hash, &self.default_configuration, &self.best_block.read().unwrap(), &&logger), chan_phase_entry);
84818481
if let Some(announcement_sigs) = announcement_sigs_opt {
84828482
log_trace!(logger, "Sending announcement_signatures for channel {}", chan.context.channel_id());
@@ -8506,7 +8506,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
85068506

85078507
Ok(())
85088508
} else {
8509-
try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
8509+
try_channel_entry!(self, peer_state, Err(ChannelError::close(
85108510
"Got a channel_ready message for an unfunded channel!".into())), chan_phase_entry)
85118511
}
85128512
},
@@ -8539,7 +8539,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
85398539
}
85408540

85418541
let funding_txo_opt = chan.context.get_funding_txo();
8542-
let (shutdown, monitor_update_opt, htlcs) = try_chan_phase_entry!(self, peer_state,
8542+
let (shutdown, monitor_update_opt, htlcs) = try_channel_entry!(self, peer_state,
85438543
chan.shutdown(&self.signer_provider, &peer_state.latest_features, &msg), chan_phase_entry);
85448544
dropped_htlcs = htlcs;
85458545

@@ -8597,7 +8597,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
85978597
hash_map::Entry::Occupied(mut chan_phase_entry) => {
85988598
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
85998599
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8600-
let (closing_signed, tx, shutdown_result) = try_chan_phase_entry!(self, peer_state, chan.closing_signed(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
8600+
let (closing_signed, tx, shutdown_result) = try_channel_entry!(self, peer_state, chan.closing_signed(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
86018601
debug_assert_eq!(shutdown_result.is_some(), chan.is_shutdown());
86028602
if let Some(msg) = closing_signed {
86038603
peer_state.pending_msg_events.push(events::MessageSendEvent::SendClosingSigned {
@@ -8619,7 +8619,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
86198619
(tx, None, None)
86208620
}
86218621
} else {
8622-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
8622+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
86238623
"Got a closing_signed message for an unfunded channel!".into())), chan_phase_entry);
86248624
}
86258625
},
@@ -8717,9 +8717,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
87178717
}
87188718
}
87198719
}
8720-
try_chan_phase_entry!(self, peer_state, chan.update_add_htlc(&msg, pending_forward_info, &self.fee_estimator), chan_phase_entry);
8720+
try_channel_entry!(self, peer_state, chan.update_add_htlc(&msg, pending_forward_info, &self.fee_estimator), chan_phase_entry);
87218721
} else {
8722-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
8722+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
87238723
"Got an update_add_htlc message for an unfunded channel!".into())), chan_phase_entry);
87248724
}
87258725
},
@@ -8743,7 +8743,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
87438743
match peer_state.channel_by_id.entry(msg.channel_id) {
87448744
hash_map::Entry::Occupied(mut chan_phase_entry) => {
87458745
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8746-
let res = try_chan_phase_entry!(self, peer_state, chan.update_fulfill_htlc(&msg), chan_phase_entry);
8746+
let res = try_channel_entry!(self, peer_state, chan.update_fulfill_htlc(&msg), chan_phase_entry);
87478747
if let HTLCSource::PreviousHopData(prev_hop) = &res.0 {
87488748
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
87498749
log_trace!(logger,
@@ -8763,7 +8763,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
87638763
next_user_channel_id = chan.context.get_user_id();
87648764
res
87658765
} else {
8766-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
8766+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
87678767
"Got an update_fulfill_htlc message for an unfunded channel!".into())), chan_phase_entry);
87688768
}
87698769
},
@@ -8792,9 +8792,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
87928792
match peer_state.channel_by_id.entry(msg.channel_id) {
87938793
hash_map::Entry::Occupied(mut chan_phase_entry) => {
87948794
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8795-
try_chan_phase_entry!(self, peer_state, chan.update_fail_htlc(&msg, HTLCFailReason::from_msg(msg)), chan_phase_entry);
8795+
try_channel_entry!(self, peer_state, chan.update_fail_htlc(&msg, HTLCFailReason::from_msg(msg)), chan_phase_entry);
87968796
} else {
8797-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
8797+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
87988798
"Got an update_fail_htlc message for an unfunded channel!".into())), chan_phase_entry);
87998799
}
88008800
},
@@ -8818,12 +8818,12 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
88188818
hash_map::Entry::Occupied(mut chan_phase_entry) => {
88198819
if (msg.failure_code & 0x8000) == 0 {
88208820
let chan_err = ChannelError::close("Got update_fail_malformed_htlc with BADONION not set".to_owned());
8821-
try_chan_phase_entry!(self, peer_state, Err(chan_err), chan_phase_entry);
8821+
try_channel_entry!(self, peer_state, Err(chan_err), chan_phase_entry);
88228822
}
88238823
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8824-
try_chan_phase_entry!(self, peer_state, chan.update_fail_malformed_htlc(&msg, HTLCFailReason::reason(msg.failure_code, msg.sha256_of_onion.to_vec())), chan_phase_entry);
8824+
try_channel_entry!(self, peer_state, chan.update_fail_malformed_htlc(&msg, HTLCFailReason::reason(msg.failure_code, msg.sha256_of_onion.to_vec())), chan_phase_entry);
88258825
} else {
8826-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
8826+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
88278827
"Got an update_fail_malformed_htlc message for an unfunded channel!".into())), chan_phase_entry);
88288828
}
88298829
Ok(())
@@ -8849,7 +8849,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
88498849
let funding_txo = chan.context.get_funding_txo();
88508850

88518851
if chan.interactive_tx_signing_session.is_some() {
8852-
let monitor = try_chan_phase_entry!(
8852+
let monitor = try_channel_entry!(
88538853
self, peer_state, chan.commitment_signed_initial_v2(msg, best_block, &self.signer_provider, &&logger),
88548854
chan_phase_entry);
88558855
let monitor_res = self.chain_monitor.watch_channel(monitor.get_funding_txo().0, monitor);
@@ -8859,15 +8859,15 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
88598859
} else {
88608860
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
88618861
log_error!(logger, "Persisting initial ChannelMonitor failed, implying the funding outpoint was duplicated");
8862-
try_chan_phase_entry!(self, peer_state, Err(ChannelError::Close(
8862+
try_channel_entry!(self, peer_state, Err(ChannelError::Close(
88638863
(
88648864
"Channel funding outpoint was a duplicate".to_owned(),
88658865
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
88668866
)
88678867
)), chan_phase_entry)
88688868
}
88698869
} else {
8870-
let monitor_update_opt = try_chan_phase_entry!(
8870+
let monitor_update_opt = try_channel_entry!(
88718871
self, peer_state, chan.commitment_signed(msg, &&logger), chan_phase_entry);
88728872
if let Some(monitor_update) = monitor_update_opt {
88738873
handle_new_monitor_update!(self, funding_txo.unwrap(), monitor_update, peer_state_lock,
@@ -8876,7 +8876,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
88768876
}
88778877
Ok(())
88788878
} else {
8879-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
8879+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
88808880
"Got a commitment_signed message for an unfunded channel!".into())), chan_phase_entry);
88818881
}
88828882
},
@@ -9069,7 +9069,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
90699069
&peer_state.actions_blocking_raa_monitor_updates, funding_txo, msg.channel_id,
90709070
*counterparty_node_id)
90719071
} else { false };
9072-
let (htlcs_to_fail, monitor_update_opt) = try_chan_phase_entry!(self, peer_state,
9072+
let (htlcs_to_fail, monitor_update_opt) = try_channel_entry!(self, peer_state,
90739073
chan.revoke_and_ack(&msg, &self.fee_estimator, &&logger, mon_update_blocked), chan_phase_entry);
90749074
if let Some(monitor_update) = monitor_update_opt {
90759075
let funding_txo = funding_txo_opt
@@ -9079,7 +9079,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
90799079
}
90809080
htlcs_to_fail
90819081
} else {
9082-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
9082+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
90839083
"Got a revoke_and_ack message for an unfunded channel!".into())), chan_phase_entry);
90849084
}
90859085
},
@@ -9103,9 +9103,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
91039103
hash_map::Entry::Occupied(mut chan_phase_entry) => {
91049104
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
91059105
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
9106-
try_chan_phase_entry!(self, peer_state, chan.update_fee(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
9106+
try_channel_entry!(self, peer_state, chan.update_fee(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
91079107
} else {
9108-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
9108+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
91099109
"Got an update_fee message for an unfunded channel!".into())), chan_phase_entry);
91109110
}
91119111
},
@@ -9131,7 +9131,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
91319131
}
91329132

91339133
peer_state.pending_msg_events.push(events::MessageSendEvent::BroadcastChannelAnnouncement {
9134-
msg: try_chan_phase_entry!(self, peer_state, chan.announcement_signatures(
9134+
msg: try_channel_entry!(self, peer_state, chan.announcement_signatures(
91359135
&self.node_signer, self.chain_hash, self.best_block.read().unwrap().height,
91369136
msg, &self.default_configuration
91379137
), chan_phase_entry),
@@ -9140,7 +9140,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
91409140
update_msg: Some(self.get_channel_update_for_broadcast(chan).unwrap()),
91419141
});
91429142
} else {
9143-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
9143+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
91449144
"Got an announcement_signatures message for an unfunded channel!".into())), chan_phase_entry);
91459145
}
91469146
},
@@ -9184,15 +9184,15 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
91849184
} else {
91859185
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
91869186
log_debug!(logger, "Received channel_update {:?} for channel {}.", msg, chan_id);
9187-
let did_change = try_chan_phase_entry!(self, peer_state, chan.channel_update(&msg), chan_phase_entry);
9187+
let did_change = try_channel_entry!(self, peer_state, chan.channel_update(&msg), chan_phase_entry);
91889188
// If nothing changed after applying their update, we don't need to bother
91899189
// persisting.
91909190
if !did_change {
91919191
return Ok(NotifyOption::SkipPersistNoEvents);
91929192
}
91939193
}
91949194
} else {
9195-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
9195+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
91969196
"Got a channel_update for an unfunded channel!".into())), chan_phase_entry);
91979197
}
91989198
},
@@ -9223,7 +9223,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
92239223
// disconnect, so Channel's reestablish will never hand us any holding cell
92249224
// freed HTLCs to fail backwards. If in the future we no longer drop pending
92259225
// add-HTLCs on disconnect, we may be handed HTLCs to fail backwards here.
9226-
let responses = try_chan_phase_entry!(self, peer_state, chan.channel_reestablish(
9226+
let responses = try_channel_entry!(self, peer_state, chan.channel_reestablish(
92279227
msg, &&logger, &self.node_signer, self.chain_hash,
92289228
&self.default_configuration, &*self.best_block.read().unwrap()), chan_phase_entry);
92299229
let mut channel_update = None;
@@ -9254,7 +9254,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
92549254
}
92559255
need_lnd_workaround
92569256
} else {
9257-
return try_chan_phase_entry!(self, peer_state, Err(ChannelError::close(
9257+
return try_channel_entry!(self, peer_state, Err(ChannelError::close(
92589258
"Got a channel_reestablish message for an unfunded channel!".into())), chan_phase_entry);
92599259
}
92609260
},

0 commit comments

Comments
 (0)