Fix failure sending FundingLocked for non-announced channels 2018-07-watch-funding
authorMatt Corallo <git@bluematt.me>
Sun, 22 Jul 2018 20:39:34 +0000 (16:39 -0400)
committerMatt Corallo <git@bluematt.me>
Sun, 22 Jul 2018 21:11:20 +0000 (17:11 -0400)
src/ln/channel.rs
src/ln/channelmanager.rs

index 4565b243710e40b6950a696c53e6467c2ffcbafb..d4d264b0ad25a21823e7c3b5fb46499cd2ad244a 100644 (file)
@@ -1843,6 +1843,10 @@ impl Channel {
                self.channel_update_count
        }
 
+       pub fn should_announce(&self) -> bool {
+               self.announce_publicly
+       }
+
        /// Gets the fee we'd want to charge for adding an HTLC output to this Channel
        pub fn get_our_fee_base_msat(&self, fee_estimator: &FeeEstimator) -> u32 {
                // For lack of a better metric, we calculate what it would cost to consolidate the new HTLC
index b17dcd8198f086ad4b5202c18e38776d4095c987..f4f9ef881bd0164edcf87454905644df723b93b8 100644 (file)
@@ -710,7 +710,7 @@ impl ChannelManager {
        }
 
        fn get_announcement_sigs(&self, chan: &Channel) -> Result<Option<msgs::AnnouncementSignatures>, HandleError> {
-               if !chan.is_usable() { return Ok(None) }
+               if !chan.is_usable() || !chan.should_announce() { return Ok(None) }
 
                let (announcement, our_bitcoin_sig) = chan.get_channel_announcement(self.get_our_node_id(), self.genesis_hash.clone())?;
                let msghash = Message::from_slice(&Sha256dHash::from_data(&announcement.encode()[..])[..]).unwrap();