@@ -3058,7 +3058,7 @@ macro_rules! break_channel_entry {
3058
3058
}
3059
3059
}
3060
3060
3061
- macro_rules! try_chan_phase_entry {
3061
+ macro_rules! try_channel_entry {
3062
3062
($self: ident, $peer_state: expr, $res: expr, $entry: expr) => {
3063
3063
match $res {
3064
3064
Ok(res) => res,
@@ -8022,7 +8022,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8022
8022
hash_map::Entry::Occupied(mut phase) => {
8023
8023
match phase.get_mut().as_unfunded_outbound_v1_mut() {
8024
8024
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);
8026
8026
(chan.context.get_value_satoshis(), chan.context.get_funding_redeemscript().to_p2wsh(), chan.context.get_user_id())
8027
8027
},
8028
8028
None => {
@@ -8298,7 +8298,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8298
8298
let (msg_send_event_opt, signing_session_opt) = match channel_phase.as_unfunded_v2_mut() {
8299
8299
Some(channel) => channel.tx_complete(msg)
8300
8300
.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(
8302
8302
(
8303
8303
"Got a tx_complete message with no interactive transaction construction expected or in-progress".into(),
8304
8304
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/
8369
8369
match channel_phase {
8370
8370
Some(chan) => {
8371
8371
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);
8373
8373
if let Some(tx_signatures) = tx_signatures_opt {
8374
8374
peer_state.pending_msg_events.push(events::MessageSendEvent::SendTxSignatures {
8375
8375
node_id: *counterparty_node_id,
@@ -8384,7 +8384,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8384
8384
}
8385
8385
}
8386
8386
},
8387
- None => try_chan_phase_entry !(self, peer_state, Err(ChannelError::Close(
8387
+ None => try_channel_entry !(self, peer_state, Err(ChannelError::Close(
8388
8388
(
8389
8389
"Got an unexpected tx_signatures message".into(),
8390
8390
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/
8420
8420
// for a "Channel::Funded" when we want to bump the fee on an interactively
8421
8421
// constructed funding tx or during splicing. For now we send an error as we would
8422
8422
// 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(
8424
8424
"Got an unexpected tx_abort message: After initial funding transaction is signed, \
8425
8425
splicing and RBF attempts of interactive funding transactions are not supported yet so \
8426
8426
we don't have any negotiation in progress".into(),
8427
8427
)), chan_phase_entry)
8428
8428
} else {
8429
- try_chan_phase_entry !(self, peer_state, Err(ChannelError::Warn(
8429
+ try_channel_entry !(self, peer_state, Err(ChannelError::Warn(
8430
8430
"Got an unexpected tx_abort message: This is an unfunded channel created with V1 channel \
8431
8431
establishment".into(),
8432
8432
)), chan_phase_entry)
@@ -8476,7 +8476,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8476
8476
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8477
8477
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8478
8478
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,
8480
8480
self.chain_hash, &self.default_configuration, &self.best_block.read().unwrap(), &&logger), chan_phase_entry);
8481
8481
if let Some(announcement_sigs) = announcement_sigs_opt {
8482
8482
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/
8506
8506
8507
8507
Ok(())
8508
8508
} else {
8509
- try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8509
+ try_channel_entry !(self, peer_state, Err(ChannelError::close(
8510
8510
"Got a channel_ready message for an unfunded channel!".into())), chan_phase_entry)
8511
8511
}
8512
8512
},
@@ -8539,7 +8539,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8539
8539
}
8540
8540
8541
8541
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,
8543
8543
chan.shutdown(&self.signer_provider, &peer_state.latest_features, &msg), chan_phase_entry);
8544
8544
dropped_htlcs = htlcs;
8545
8545
@@ -8597,7 +8597,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8597
8597
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8598
8598
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8599
8599
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);
8601
8601
debug_assert_eq!(shutdown_result.is_some(), chan.is_shutdown());
8602
8602
if let Some(msg) = closing_signed {
8603
8603
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/
8619
8619
(tx, None, None)
8620
8620
}
8621
8621
} else {
8622
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8622
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8623
8623
"Got a closing_signed message for an unfunded channel!".into())), chan_phase_entry);
8624
8624
}
8625
8625
},
@@ -8717,9 +8717,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8717
8717
}
8718
8718
}
8719
8719
}
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);
8721
8721
} else {
8722
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8722
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8723
8723
"Got an update_add_htlc message for an unfunded channel!".into())), chan_phase_entry);
8724
8724
}
8725
8725
},
@@ -8743,7 +8743,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8743
8743
match peer_state.channel_by_id.entry(msg.channel_id) {
8744
8744
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8745
8745
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);
8747
8747
if let HTLCSource::PreviousHopData(prev_hop) = &res.0 {
8748
8748
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8749
8749
log_trace!(logger,
@@ -8763,7 +8763,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8763
8763
next_user_channel_id = chan.context.get_user_id();
8764
8764
res
8765
8765
} else {
8766
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8766
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8767
8767
"Got an update_fulfill_htlc message for an unfunded channel!".into())), chan_phase_entry);
8768
8768
}
8769
8769
},
@@ -8792,9 +8792,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8792
8792
match peer_state.channel_by_id.entry(msg.channel_id) {
8793
8793
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8794
8794
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);
8796
8796
} else {
8797
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8797
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8798
8798
"Got an update_fail_htlc message for an unfunded channel!".into())), chan_phase_entry);
8799
8799
}
8800
8800
},
@@ -8818,12 +8818,12 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8818
8818
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8819
8819
if (msg.failure_code & 0x8000) == 0 {
8820
8820
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);
8822
8822
}
8823
8823
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);
8825
8825
} else {
8826
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8826
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8827
8827
"Got an update_fail_malformed_htlc message for an unfunded channel!".into())), chan_phase_entry);
8828
8828
}
8829
8829
Ok(())
@@ -8849,7 +8849,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8849
8849
let funding_txo = chan.context.get_funding_txo();
8850
8850
8851
8851
if chan.interactive_tx_signing_session.is_some() {
8852
- let monitor = try_chan_phase_entry !(
8852
+ let monitor = try_channel_entry !(
8853
8853
self, peer_state, chan.commitment_signed_initial_v2(msg, best_block, &self.signer_provider, &&logger),
8854
8854
chan_phase_entry);
8855
8855
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/
8859
8859
} else {
8860
8860
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8861
8861
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(
8863
8863
(
8864
8864
"Channel funding outpoint was a duplicate".to_owned(),
8865
8865
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
8866
8866
)
8867
8867
)), chan_phase_entry)
8868
8868
}
8869
8869
} else {
8870
- let monitor_update_opt = try_chan_phase_entry !(
8870
+ let monitor_update_opt = try_channel_entry !(
8871
8871
self, peer_state, chan.commitment_signed(msg, &&logger), chan_phase_entry);
8872
8872
if let Some(monitor_update) = monitor_update_opt {
8873
8873
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/
8876
8876
}
8877
8877
Ok(())
8878
8878
} else {
8879
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8879
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8880
8880
"Got a commitment_signed message for an unfunded channel!".into())), chan_phase_entry);
8881
8881
}
8882
8882
},
@@ -9069,7 +9069,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9069
9069
&peer_state.actions_blocking_raa_monitor_updates, funding_txo, msg.channel_id,
9070
9070
*counterparty_node_id)
9071
9071
} 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,
9073
9073
chan.revoke_and_ack(&msg, &self.fee_estimator, &&logger, mon_update_blocked), chan_phase_entry);
9074
9074
if let Some(monitor_update) = monitor_update_opt {
9075
9075
let funding_txo = funding_txo_opt
@@ -9079,7 +9079,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9079
9079
}
9080
9080
htlcs_to_fail
9081
9081
} else {
9082
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9082
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9083
9083
"Got a revoke_and_ack message for an unfunded channel!".into())), chan_phase_entry);
9084
9084
}
9085
9085
},
@@ -9103,9 +9103,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9103
9103
hash_map::Entry::Occupied(mut chan_phase_entry) => {
9104
9104
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
9105
9105
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);
9107
9107
} else {
9108
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9108
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9109
9109
"Got an update_fee message for an unfunded channel!".into())), chan_phase_entry);
9110
9110
}
9111
9111
},
@@ -9131,7 +9131,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9131
9131
}
9132
9132
9133
9133
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(
9135
9135
&self.node_signer, self.chain_hash, self.best_block.read().unwrap().height,
9136
9136
msg, &self.default_configuration
9137
9137
), chan_phase_entry),
@@ -9140,7 +9140,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9140
9140
update_msg: Some(self.get_channel_update_for_broadcast(chan).unwrap()),
9141
9141
});
9142
9142
} else {
9143
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9143
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9144
9144
"Got an announcement_signatures message for an unfunded channel!".into())), chan_phase_entry);
9145
9145
}
9146
9146
},
@@ -9184,15 +9184,15 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9184
9184
} else {
9185
9185
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
9186
9186
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);
9188
9188
// If nothing changed after applying their update, we don't need to bother
9189
9189
// persisting.
9190
9190
if !did_change {
9191
9191
return Ok(NotifyOption::SkipPersistNoEvents);
9192
9192
}
9193
9193
}
9194
9194
} else {
9195
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9195
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9196
9196
"Got a channel_update for an unfunded channel!".into())), chan_phase_entry);
9197
9197
}
9198
9198
},
@@ -9223,7 +9223,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9223
9223
// disconnect, so Channel's reestablish will never hand us any holding cell
9224
9224
// freed HTLCs to fail backwards. If in the future we no longer drop pending
9225
9225
// 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(
9227
9227
msg, &&logger, &self.node_signer, self.chain_hash,
9228
9228
&self.default_configuration, &*self.best_block.read().unwrap()), chan_phase_entry);
9229
9229
let mut channel_update = None;
@@ -9254,7 +9254,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9254
9254
}
9255
9255
need_lnd_workaround
9256
9256
} else {
9257
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9257
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9258
9258
"Got a channel_reestablish message for an unfunded channel!".into())), chan_phase_entry);
9259
9259
}
9260
9260
},
0 commit comments