From fd223c39eda33fd55cdef2b0fcbd3353082add27 Mon Sep 17 00:00:00 2001 From: niftynei Date: Fri, 2 Jul 2021 15:54:03 -0500 Subject: [PATCH] channel lease: update the blockheight on reconnect, also We need to update the peer wrt our blockheight on reconnect --- channeld/channeld.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/channeld/channeld.c b/channeld/channeld.c index 6b08faca8..438de3c20 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -2364,9 +2364,12 @@ static void resend_commitment(struct peer *peer, struct changed_htlc *last) const struct htlc **htlc_map; struct wally_tx_output *direct_outputs[NUM_SIDES]; - status_debug("Retransmitting commitment, feerate LOCAL=%u REMOTE=%u", + status_debug("Retransmitting commitment, feerate LOCAL=%u REMOTE=%u," + " blockheight LOCAL=%u REMOTE=%u", channel_feerate(peer->channel, LOCAL), - channel_feerate(peer->channel, REMOTE)); + channel_feerate(peer->channel, REMOTE), + channel_blockheight(peer->channel, LOCAL), + channel_blockheight(peer->channel, REMOTE)); /* Note that HTLCs must be *added* in order. Simplest thing to do * is to sort them all into ascending ID order here (we could do @@ -2442,11 +2445,15 @@ static void resend_commitment(struct peer *peer, struct changed_htlc *last) } } - /* Make sure they have the correct fee. */ + /* Make sure they have the correct fee and blockheight. */ if (peer->channel->opener == LOCAL) { msg = towire_update_fee(NULL, &peer->channel_id, channel_feerate(peer->channel, REMOTE)); sync_crypto_write(peer->pps, take(msg)); + + msg = towire_update_blockheight(NULL, &peer->channel_id, + channel_blockheight(peer->channel, REMOTE)); + sync_crypto_write(peer->pps, take(msg)); } /* Re-send the commitment_signed itself. */