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.
This commit is contained in:
Matt Corallo 2023-02-01 20:54:10 +00:00
parent d0b8f455fe
commit 5be29c6add
3 changed files with 5 additions and 5 deletions

View file

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

View file

@ -2390,10 +2390,10 @@ where
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
let peer_state = &mut *peer_state_lock;
if let hash_map::Entry::Occupied(mut chan) = peer_state.channel_by_id.entry(id) {
if !chan.get().is_live() {
return Err(APIError::ChannelUnavailable{err: "Peer for first hop currently disconnected".to_owned()});
}
match {
if !chan.get().is_live() {
return Err(APIError::ChannelUnavailable{err: "Peer for first hop currently disconnected/pending monitor update!".to_owned()});
}
break_chan_entry!(self, chan.get_mut().send_htlc_and_commit(
htlc_msat, payment_hash.clone(), htlc_cltv, HTLCSource::OutboundRoute {
path: path.clone(),

View file

@ -258,7 +258,7 @@ fn no_pending_leak_on_initial_send_failure() {
unwrap_send_err!(nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret), PaymentId(payment_hash.0)),
true, APIError::ChannelUnavailable { ref err },
assert_eq!(err, "Peer for first hop currently disconnected/pending monitor update!"));
assert_eq!(err, "Peer for first hop currently disconnected"));
assert!(!nodes[0].node.has_pending_payments());
}