]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix the err msg provided when a send fails due to peer disconnected
authorMatt Corallo <git@bluematt.me>
Wed, 1 Feb 2023 20:54:10 +0000 (20:54 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 17 Feb 2023 19:09:28 +0000 (19:09 +0000)
We haven't had a `MonitorUpdateInProgress` check in
`Channel::is_live` for some time.

fuzz/src/chanmon_consistency.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/payment_tests.rs

index 39887e838401c545a6002e128d58c6330eb108d2..41b10fb5a32d051f8d341fba2709b4033a60be6b 100644 (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") => {},
index d47fbe0babd17d98d1674c58377d7bf3942bbeb8..04158da3e391b7764505a66d2941942bec2c447b 100644 (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(),
index 4c228a3226aeaa6ce89b5056623d3747785c24cb..ef9a9d3755bbe870b501e85fef7c66f50a66fa5d 100644 (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());
 }