]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Do not allow sending HTLCs when the first hop is disconnected
authorMatt Corallo <git@bluematt.me>
Sat, 8 Sep 2018 19:53:05 +0000 (15:53 -0400)
committerMatt Corallo <git@bluematt.me>
Sun, 9 Sep 2018 15:36:00 +0000 (11:36 -0400)
src/ln/channelmanager.rs

index 4bcd35bc5d21f3b9fe1af01cc6cc29f346820834..baf211fdba527f7f65b2980b2eb2a5ca9cdf1c33 100644 (file)
@@ -985,6 +985,9 @@ impl ChannelManager {
                                if chan.get_their_node_id() != route.hops.first().unwrap().pubkey {
                                        return Err(HandleError{err: "Node ID mismatch on first hop!", action: None});
                                }
+                               if !chan.is_live() {
+                                       return Err(HandleError{err: "Peer for first hop currently disconnected!", action: None});
+                               }
                                chan.send_htlc_and_commit(htlc_msat, payment_hash, htlc_cltv, onion_packet)?
                        };