Skip to content

Commit

Permalink
channeld: don't spin trying to send commitment while waiting.
Browse files Browse the repository at this point in the history
We would sleep for 10msec (default) and try again, spamming the logs
every second.  But we're waiting for revoke_and_ack, and that handler
already sets off the timer, so there's no need to spin at all!

Fixes: ElementsProject#6077
Changelog-Fixed: `channeld`: no longer spin and spam logs when waiting for revoke_and_ack.
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and ddustin committed Apr 11, 2023
1 parent f5ab0c4 commit fbc2254
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ struct peer {

struct timers timers;
struct oneshot *commit_timer;
u64 commit_timer_attempts;
u32 commit_msec;

/* The feerate we want. */
Expand Down Expand Up @@ -1234,20 +1233,11 @@ static void send_commit(struct peer *peer)
if (peer->revocations_received != peer->next_index[REMOTE] - 1) {
assert(peer->revocations_received
== peer->next_index[REMOTE] - 2);
peer->commit_timer_attempts++;
/* Only report this in extreme cases */
if (peer->commit_timer_attempts % 100 == 0)
status_debug("Can't send commit:"
" waiting for revoke_and_ack with %"
PRIu64" attempts",
peer->commit_timer_attempts);
/* Mark this as done and try again. */
status_debug("Can't send commit: waiting for revoke_and_ack");
/* Mark this as done: handle_peer_revoke_and_ack will
* restart. */
peer->commit_timer = NULL;
start_commit_timer(peer);
return;
} else {
/* We can advance; wipe attempts */
peer->commit_timer_attempts = 0;
}

/* BOLT #2:
Expand Down Expand Up @@ -3989,7 +3979,6 @@ int main(int argc, char *argv[])
peer->shutdown_wrong_funding = NULL;
peer->last_update_timestamp = 0;
peer->last_empty_commitment = 0;
peer->commit_timer_attempts = 0;
#if EXPERIMENTAL_FEATURES
peer->stfu = false;
peer->stfu_sent[LOCAL] = peer->stfu_sent[REMOTE] = false;
Expand Down

0 comments on commit fbc2254

Please sign in to comment.