@@ -3066,7 +3066,7 @@ macro_rules! break_channel_entry {
3066
3066
}
3067
3067
}
3068
3068
3069
- macro_rules! try_chan_phase_entry {
3069
+ macro_rules! try_channel_entry {
3070
3070
($self: ident, $peer_state: expr, $res: expr, $entry: expr) => {
3071
3071
match $res {
3072
3072
Ok(res) => res,
@@ -8014,7 +8014,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8014
8014
hash_map::Entry::Occupied(mut phase) => {
8015
8015
match phase.get_mut().as_unfunded_outbound_v1_mut() {
8016
8016
Some(chan) => {
8017
- try_chan_phase_entry !(self, peer_state, chan.accept_channel(msg, &self.default_configuration.channel_handshake_limits, &peer_state.latest_features), phase);
8017
+ try_channel_entry !(self, peer_state, chan.accept_channel(msg, &self.default_configuration.channel_handshake_limits, &peer_state.latest_features), phase);
8018
8018
(chan.context.get_value_satoshis(), chan.context.get_funding_redeemscript().to_p2wsh(), chan.context.get_user_id())
8019
8019
},
8020
8020
None => {
@@ -8290,7 +8290,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8290
8290
let (msg_send_event_opt, signing_session_opt) = match channel_phase.as_unfunded_v2_mut() {
8291
8291
Some(channel) => channel.tx_complete(msg)
8292
8292
.into_msg_send_event_or_signing_session(counterparty_node_id),
8293
- None => try_chan_phase_entry !(self, peer_state, Err(ChannelError::Close(
8293
+ None => try_channel_entry !(self, peer_state, Err(ChannelError::Close(
8294
8294
(
8295
8295
"Got a tx_complete message with no interactive transaction construction expected or in-progress".into(),
8296
8296
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
@@ -8361,7 +8361,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8361
8361
match channel_phase {
8362
8362
Some(chan) => {
8363
8363
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8364
- let (tx_signatures_opt, funding_tx_opt) = try_chan_phase_entry !(self, peer_state, chan.tx_signatures(msg, &&logger), chan_phase_entry);
8364
+ let (tx_signatures_opt, funding_tx_opt) = try_channel_entry !(self, peer_state, chan.tx_signatures(msg, &&logger), chan_phase_entry);
8365
8365
if let Some(tx_signatures) = tx_signatures_opt {
8366
8366
peer_state.pending_msg_events.push(events::MessageSendEvent::SendTxSignatures {
8367
8367
node_id: *counterparty_node_id,
@@ -8376,7 +8376,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8376
8376
}
8377
8377
}
8378
8378
},
8379
- None => try_chan_phase_entry !(self, peer_state, Err(ChannelError::Close(
8379
+ None => try_channel_entry !(self, peer_state, Err(ChannelError::Close(
8380
8380
(
8381
8381
"Got an unexpected tx_signatures message".into(),
8382
8382
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
@@ -8412,13 +8412,13 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8412
8412
// for a "Channel::Funded" when we want to bump the fee on an interactively
8413
8413
// constructed funding tx or during splicing. For now we send an error as we would
8414
8414
// never ack an RBF attempt or a splice for now:
8415
- try_chan_phase_entry !(self, peer_state, Err(ChannelError::Warn(
8415
+ try_channel_entry !(self, peer_state, Err(ChannelError::Warn(
8416
8416
"Got an unexpected tx_abort message: After initial funding transaction is signed, \
8417
8417
splicing and RBF attempts of interactive funding transactions are not supported yet so \
8418
8418
we don't have any negotiation in progress".into(),
8419
8419
)), chan_phase_entry)
8420
8420
} else {
8421
- try_chan_phase_entry !(self, peer_state, Err(ChannelError::Warn(
8421
+ try_channel_entry !(self, peer_state, Err(ChannelError::Warn(
8422
8422
"Got an unexpected tx_abort message: This is an unfunded channel created with V1 channel \
8423
8423
establishment".into(),
8424
8424
)), chan_phase_entry)
@@ -8468,7 +8468,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8468
8468
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8469
8469
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8470
8470
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8471
- let announcement_sigs_opt = try_chan_phase_entry !(self, peer_state, chan.channel_ready(&msg, &self.node_signer,
8471
+ let announcement_sigs_opt = try_channel_entry !(self, peer_state, chan.channel_ready(&msg, &self.node_signer,
8472
8472
self.chain_hash, &self.default_configuration, &self.best_block.read().unwrap(), &&logger), chan_phase_entry);
8473
8473
if let Some(announcement_sigs) = announcement_sigs_opt {
8474
8474
log_trace!(logger, "Sending announcement_signatures for channel {}", chan.context.channel_id());
@@ -8498,7 +8498,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8498
8498
8499
8499
Ok(())
8500
8500
} else {
8501
- try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8501
+ try_channel_entry !(self, peer_state, Err(ChannelError::close(
8502
8502
"Got a channel_ready message for an unfunded channel!".into())), chan_phase_entry)
8503
8503
}
8504
8504
},
@@ -8531,7 +8531,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8531
8531
}
8532
8532
8533
8533
let funding_txo_opt = chan.context.get_funding_txo();
8534
- let (shutdown, monitor_update_opt, htlcs) = try_chan_phase_entry !(self, peer_state,
8534
+ let (shutdown, monitor_update_opt, htlcs) = try_channel_entry !(self, peer_state,
8535
8535
chan.shutdown(&self.signer_provider, &peer_state.latest_features, &msg), chan_phase_entry);
8536
8536
dropped_htlcs = htlcs;
8537
8537
@@ -8589,7 +8589,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8589
8589
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8590
8590
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8591
8591
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8592
- let (closing_signed, tx, shutdown_result) = try_chan_phase_entry !(self, peer_state, chan.closing_signed(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
8592
+ let (closing_signed, tx, shutdown_result) = try_channel_entry !(self, peer_state, chan.closing_signed(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
8593
8593
debug_assert_eq!(shutdown_result.is_some(), chan.is_shutdown());
8594
8594
if let Some(msg) = closing_signed {
8595
8595
peer_state.pending_msg_events.push(events::MessageSendEvent::SendClosingSigned {
@@ -8611,7 +8611,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8611
8611
(tx, None, None)
8612
8612
}
8613
8613
} else {
8614
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8614
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8615
8615
"Got a closing_signed message for an unfunded channel!".into())), chan_phase_entry);
8616
8616
}
8617
8617
},
@@ -8662,9 +8662,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8662
8662
match peer_state.channel_by_id.entry(msg.channel_id) {
8663
8663
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8664
8664
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8665
- try_chan_phase_entry !(self, peer_state, chan.update_add_htlc(&msg, &self.fee_estimator), chan_phase_entry);
8665
+ try_channel_entry !(self, peer_state, chan.update_add_htlc(&msg, &self.fee_estimator), chan_phase_entry);
8666
8666
} else {
8667
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8667
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8668
8668
"Got an update_add_htlc message for an unfunded channel!".into())), chan_phase_entry);
8669
8669
}
8670
8670
},
@@ -8688,7 +8688,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8688
8688
match peer_state.channel_by_id.entry(msg.channel_id) {
8689
8689
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8690
8690
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8691
- let res = try_chan_phase_entry !(self, peer_state, chan.update_fulfill_htlc(&msg), chan_phase_entry);
8691
+ let res = try_channel_entry !(self, peer_state, chan.update_fulfill_htlc(&msg), chan_phase_entry);
8692
8692
if let HTLCSource::PreviousHopData(prev_hop) = &res.0 {
8693
8693
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8694
8694
log_trace!(logger,
@@ -8708,7 +8708,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8708
8708
next_user_channel_id = chan.context.get_user_id();
8709
8709
res
8710
8710
} else {
8711
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8711
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8712
8712
"Got an update_fulfill_htlc message for an unfunded channel!".into())), chan_phase_entry);
8713
8713
}
8714
8714
},
@@ -8737,9 +8737,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8737
8737
match peer_state.channel_by_id.entry(msg.channel_id) {
8738
8738
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8739
8739
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8740
- try_chan_phase_entry !(self, peer_state, chan.update_fail_htlc(&msg, HTLCFailReason::from_msg(msg)), chan_phase_entry);
8740
+ try_channel_entry !(self, peer_state, chan.update_fail_htlc(&msg, HTLCFailReason::from_msg(msg)), chan_phase_entry);
8741
8741
} else {
8742
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8742
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8743
8743
"Got an update_fail_htlc message for an unfunded channel!".into())), chan_phase_entry);
8744
8744
}
8745
8745
},
@@ -8763,12 +8763,12 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8763
8763
hash_map::Entry::Occupied(mut chan_phase_entry) => {
8764
8764
if (msg.failure_code & 0x8000) == 0 {
8765
8765
let chan_err = ChannelError::close("Got update_fail_malformed_htlc with BADONION not set".to_owned());
8766
- try_chan_phase_entry !(self, peer_state, Err(chan_err), chan_phase_entry);
8766
+ try_channel_entry !(self, peer_state, Err(chan_err), chan_phase_entry);
8767
8767
}
8768
8768
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
8769
- 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);
8769
+ 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);
8770
8770
} else {
8771
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8771
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8772
8772
"Got an update_fail_malformed_htlc message for an unfunded channel!".into())), chan_phase_entry);
8773
8773
}
8774
8774
Ok(())
@@ -8794,7 +8794,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8794
8794
let funding_txo = chan.context.get_funding_txo();
8795
8795
8796
8796
if chan.interactive_tx_signing_session.is_some() {
8797
- let monitor = try_chan_phase_entry !(
8797
+ let monitor = try_channel_entry !(
8798
8798
self, peer_state, chan.commitment_signed_initial_v2(msg, best_block, &self.signer_provider, &&logger),
8799
8799
chan_phase_entry);
8800
8800
let monitor_res = self.chain_monitor.watch_channel(monitor.get_funding_txo().0, monitor);
@@ -8804,15 +8804,15 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8804
8804
} else {
8805
8805
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
8806
8806
log_error!(logger, "Persisting initial ChannelMonitor failed, implying the funding outpoint was duplicated");
8807
- try_chan_phase_entry !(self, peer_state, Err(ChannelError::Close(
8807
+ try_channel_entry !(self, peer_state, Err(ChannelError::Close(
8808
8808
(
8809
8809
"Channel funding outpoint was a duplicate".to_owned(),
8810
8810
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
8811
8811
)
8812
8812
)), chan_phase_entry)
8813
8813
}
8814
8814
} else {
8815
- let monitor_update_opt = try_chan_phase_entry !(
8815
+ let monitor_update_opt = try_channel_entry !(
8816
8816
self, peer_state, chan.commitment_signed(msg, &&logger), chan_phase_entry);
8817
8817
if let Some(monitor_update) = monitor_update_opt {
8818
8818
handle_new_monitor_update!(self, funding_txo.unwrap(), monitor_update, peer_state_lock,
@@ -8821,7 +8821,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8821
8821
}
8822
8822
Ok(())
8823
8823
} else {
8824
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
8824
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
8825
8825
"Got a commitment_signed message for an unfunded channel!".into())), chan_phase_entry);
8826
8826
}
8827
8827
},
@@ -9014,7 +9014,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9014
9014
&peer_state.actions_blocking_raa_monitor_updates, funding_txo, msg.channel_id,
9015
9015
*counterparty_node_id)
9016
9016
} else { false };
9017
- let (htlcs_to_fail, monitor_update_opt) = try_chan_phase_entry !(self, peer_state,
9017
+ let (htlcs_to_fail, monitor_update_opt) = try_channel_entry !(self, peer_state,
9018
9018
chan.revoke_and_ack(&msg, &self.fee_estimator, &&logger, mon_update_blocked), chan_phase_entry);
9019
9019
if let Some(monitor_update) = monitor_update_opt {
9020
9020
let funding_txo = funding_txo_opt
@@ -9024,7 +9024,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9024
9024
}
9025
9025
htlcs_to_fail
9026
9026
} else {
9027
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9027
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9028
9028
"Got a revoke_and_ack message for an unfunded channel!".into())), chan_phase_entry);
9029
9029
}
9030
9030
},
@@ -9048,9 +9048,9 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9048
9048
hash_map::Entry::Occupied(mut chan_phase_entry) => {
9049
9049
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
9050
9050
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
9051
- try_chan_phase_entry !(self, peer_state, chan.update_fee(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
9051
+ try_channel_entry !(self, peer_state, chan.update_fee(&self.fee_estimator, &msg, &&logger), chan_phase_entry);
9052
9052
} else {
9053
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9053
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9054
9054
"Got an update_fee message for an unfunded channel!".into())), chan_phase_entry);
9055
9055
}
9056
9056
},
@@ -9076,7 +9076,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9076
9076
}
9077
9077
9078
9078
peer_state.pending_msg_events.push(events::MessageSendEvent::BroadcastChannelAnnouncement {
9079
- msg: try_chan_phase_entry !(self, peer_state, chan.announcement_signatures(
9079
+ msg: try_channel_entry !(self, peer_state, chan.announcement_signatures(
9080
9080
&self.node_signer, self.chain_hash, self.best_block.read().unwrap().height,
9081
9081
msg, &self.default_configuration
9082
9082
), chan_phase_entry),
@@ -9085,7 +9085,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9085
9085
update_msg: Some(self.get_channel_update_for_broadcast(chan).unwrap()),
9086
9086
});
9087
9087
} else {
9088
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9088
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9089
9089
"Got an announcement_signatures message for an unfunded channel!".into())), chan_phase_entry);
9090
9090
}
9091
9091
},
@@ -9129,15 +9129,15 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9129
9129
} else {
9130
9130
let logger = WithChannelContext::from(&self.logger, &chan.context, None);
9131
9131
log_debug!(logger, "Received channel_update {:?} for channel {}.", msg, chan_id);
9132
- let did_change = try_chan_phase_entry !(self, peer_state, chan.channel_update(&msg), chan_phase_entry);
9132
+ let did_change = try_channel_entry !(self, peer_state, chan.channel_update(&msg), chan_phase_entry);
9133
9133
// If nothing changed after applying their update, we don't need to bother
9134
9134
// persisting.
9135
9135
if !did_change {
9136
9136
return Ok(NotifyOption::SkipPersistNoEvents);
9137
9137
}
9138
9138
}
9139
9139
} else {
9140
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9140
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9141
9141
"Got a channel_update for an unfunded channel!".into())), chan_phase_entry);
9142
9142
}
9143
9143
},
@@ -9168,7 +9168,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9168
9168
// disconnect, so Channel's reestablish will never hand us any holding cell
9169
9169
// freed HTLCs to fail backwards. If in the future we no longer drop pending
9170
9170
// add-HTLCs on disconnect, we may be handed HTLCs to fail backwards here.
9171
- let responses = try_chan_phase_entry !(self, peer_state, chan.channel_reestablish(
9171
+ let responses = try_channel_entry !(self, peer_state, chan.channel_reestablish(
9172
9172
msg, &&logger, &self.node_signer, self.chain_hash,
9173
9173
&self.default_configuration, &*self.best_block.read().unwrap()), chan_phase_entry);
9174
9174
let mut channel_update = None;
@@ -9199,7 +9199,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
9199
9199
}
9200
9200
need_lnd_workaround
9201
9201
} else {
9202
- return try_chan_phase_entry !(self, peer_state, Err(ChannelError::close(
9202
+ return try_channel_entry !(self, peer_state, Err(ChannelError::close(
9203
9203
"Got a channel_reestablish message for an unfunded channel!".into())), chan_phase_entry);
9204
9204
}
9205
9205
},
0 commit comments