Skip to content

Commit 5be29c6

Browse files
committed
Fix the err msg provided when a send fails due to peer disconnected
We haven't had a `MonitorUpdateInProgress` check in `Channel::is_live` for some time.
1 parent d0b8f45 commit 5be29c6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ fn check_api_err(api_err: APIError) {
295295
// all others. If you hit this panic, the list of acceptable errors
296296
// is probably just stale and you should add new messages here.
297297
match err.as_str() {
298-
"Peer for first hop currently disconnected/pending monitor update!" => {},
298+
"Peer for first hop currently disconnected" => {},
299299
_ if err.starts_with("Cannot push more than their max accepted HTLCs ") => {},
300300
_ if err.starts_with("Cannot send value that would put us over the max HTLC value in flight our peer will accept ") => {},
301301
_ if err.starts_with("Cannot send value that would put our balance under counterparty-announced channel reserve value") => {},

lightning/src/ln/channelmanager.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,10 +2390,10 @@ where
23902390
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
23912391
let peer_state = &mut *peer_state_lock;
23922392
if let hash_map::Entry::Occupied(mut chan) = peer_state.channel_by_id.entry(id) {
2393+
if !chan.get().is_live() {
2394+
return Err(APIError::ChannelUnavailable{err: "Peer for first hop currently disconnected".to_owned()});
2395+
}
23932396
match {
2394-
if !chan.get().is_live() {
2395-
return Err(APIError::ChannelUnavailable{err: "Peer for first hop currently disconnected/pending monitor update!".to_owned()});
2396-
}
23972397
break_chan_entry!(self, chan.get_mut().send_htlc_and_commit(
23982398
htlc_msat, payment_hash.clone(), htlc_cltv, HTLCSource::OutboundRoute {
23992399
path: path.clone(),

lightning/src/ln/payment_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ fn no_pending_leak_on_initial_send_failure() {
258258

259259
unwrap_send_err!(nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret), PaymentId(payment_hash.0)),
260260
true, APIError::ChannelUnavailable { ref err },
261-
assert_eq!(err, "Peer for first hop currently disconnected/pending monitor update!"));
261+
assert_eq!(err, "Peer for first hop currently disconnected"));
262262

263263
assert!(!nodes[0].node.has_pending_payments());
264264
}

0 commit comments

Comments
 (0)