From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Thu, 6 May 2021 21:49:24 +0000 (+0000) Subject: Merge pull request #911 from TheBlueMatt/2021-05-fix-cltv-diff X-Git-Tag: v0.0.98~31 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=d2955be5cf7fa96057c416a7899e7db6a0c5e622;hp=-c;p=rust-lightning Merge pull request #911 from TheBlueMatt/2021-05-fix-cltv-diff --- d2955be5cf7fa96057c416a7899e7db6a0c5e622 diff --combined lightning/src/chain/channelmonitor.rs index 004c2381,a2c1abe7..62cb740e --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@@ -206,7 -206,7 +206,7 @@@ pub(crate) const CLTV_SHARED_CLAIM_BUFF /// HTLC-Success transaction. /// In other words, this is an upper bound on how many blocks we think it can take us to get a /// transaction confirmed (and we use it in a few more, equivalent, places). - pub(crate) const CLTV_CLAIM_BUFFER: u32 = 6; + pub(crate) const CLTV_CLAIM_BUFFER: u32 = 18; /// Number of blocks by which point we expect our counterparty to have seen new blocks on the /// network and done a full update_fail_htlc/commitment_signed dance (+ we've updated all our /// copies of ChannelMonitors, including watchtowers). We could enforce the contract by failing @@@ -1568,7 -1568,6 +1568,7 @@@ impl ChannelMonitorImpl) { + pub fn broadcast_node_announcement(&self, rgb: [u8; 3], alias: [u8; 32], mut addresses: Vec) { let _persistence_guard = PersistenceNotifierGuard::new(&self.total_consistency_lock, &self.persistence_notifier); if addresses.len() > 500 { panic!("More than half the message size was taken up by public addresses!"); } + // While all existing nodes handle unsorted addresses just fine, the spec requires that + // addresses be sorted for future compatibility. + addresses.sort_by_key(|addr| addr.get_id()); + let announcement = msgs::UnsignedNodeAnnouncement { features: NodeFeatures::known(), timestamp: self.last_node_announcement_serial.fetch_add(1, Ordering::AcqRel) as u32, @@@ -2540,7 -2539,6 +2543,7 @@@ }, } if let Some(tx) = funding_broadcastable { + log_info!(self.logger, "Broadcasting funding transaction with txid {}", tx.txid()); self.tx_broadcaster.broadcast_transaction(&tx); } if let Some(msg) = funding_locked { @@@ -2696,7 -2694,6 +2699,7 @@@ hash_map::Entry::Vacant(_) => return Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel".to_owned(), msg.channel_id)) } }; + log_info!(self.logger, "Broadcasting funding transaction with txid {}", funding_tx.txid()); self.tx_broadcaster.broadcast_transaction(&funding_tx); Ok(()) } @@@ -2811,7 -2808,7 +2814,7 @@@ } }; if let Some(broadcast_tx) = tx { - log_trace!(self.logger, "Broadcast onchain {}", log_tx!(broadcast_tx)); + log_info!(self.logger, "Broadcasting {}", log_tx!(broadcast_tx)); self.tx_broadcaster.broadcast_transaction(&broadcast_tx); } if let Some(chan) = chan_option {