lightningd: don't always defer commitment_signed if we're not synced.
Because my node runs under valgrind, it can take quite a while to sync; nodes tend to disconnect and reconnect if you block too long. This is particularly problematic since we often update fees: when the other side sends its commitment_signed we block. In particular, this triggers the corner case we have where we update_fee twice, disconnecting each time, and our state machine gets confused (which is why we never saw this exact corner case before this change in 0.7.3!). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
38d88f1aff
commit
d56513362a
|
@ -1546,24 +1546,6 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||||
size_t i;
|
size_t i;
|
||||||
struct lightningd *ld = channel->peer->ld;
|
struct lightningd *ld = channel->peer->ld;
|
||||||
|
|
||||||
/* If we're not synced with bitcoin network, we can't accept
|
|
||||||
* any HTLCs. We stall at this point, in the hope that it
|
|
||||||
* won't take long! */
|
|
||||||
if (!topology_synced(ld->topology)) {
|
|
||||||
struct deferred_commitsig *d;
|
|
||||||
|
|
||||||
log_unusual(channel->log,
|
|
||||||
"Deferring incoming commit until we sync");
|
|
||||||
|
|
||||||
/* If subdaemon dies, we want to forget this. */
|
|
||||||
d = tal(channel->owner, struct deferred_commitsig);
|
|
||||||
d->channel = channel;
|
|
||||||
d->msg = tal_dup_arr(d, u8, msg, tal_count(msg), 0);
|
|
||||||
topology_add_sync_waiter(d, ld->topology,
|
|
||||||
retry_deferred_commitsig, d);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fromwire_channel_got_commitsig(msg, msg,
|
if (!fromwire_channel_got_commitsig(msg, msg,
|
||||||
&commitnum,
|
&commitnum,
|
||||||
&feerate,
|
&feerate,
|
||||||
|
@ -1580,6 +1562,25 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||||
tal_hex(channel, msg));
|
tal_hex(channel, msg));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we're not synced with bitcoin network, we can't accept
|
||||||
|
* any new HTLCs. We stall at this point, in the hope that it
|
||||||
|
* won't take long! */
|
||||||
|
if (added && !topology_synced(ld->topology)) {
|
||||||
|
struct deferred_commitsig *d;
|
||||||
|
|
||||||
|
log_unusual(channel->log,
|
||||||
|
"Deferring incoming commit until we sync");
|
||||||
|
|
||||||
|
/* If subdaemon dies, we want to forget this. */
|
||||||
|
d = tal(channel->owner, struct deferred_commitsig);
|
||||||
|
d->channel = channel;
|
||||||
|
d->msg = tal_dup_arr(d, u8, msg, tal_count(msg), 0);
|
||||||
|
topology_add_sync_waiter(d, ld->topology,
|
||||||
|
retry_deferred_commitsig, d);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tx->chainparams = chainparams;
|
tx->chainparams = chainparams;
|
||||||
|
|
||||||
log_debug(channel->log,
|
log_debug(channel->log,
|
||||||
|
|
Loading…
Reference in New Issue