channeld: don't ever send back-to-back feerate changes.

There are several reports of desynchronization with LND here; a simple
approach is to only have one feerate change in flight at any time.

Even if this turns out to be our fault, it's been a historic area of
confusion, so this restriction seems reasonable.

Changelog-Fixed: Protocol: Don't create more than one feerate change at a time, as this seems to desync with LND.
Fixes: #4152
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-04-21 15:54:26 +09:30
parent e3d1115598
commit e64e6ba283
3 changed files with 45 additions and 14 deletions

View File

@@ -73,6 +73,16 @@ u32 get_feerate(const struct fee_states *fee_states,
abort();
}
/* Are feerates all agreed by both sides? */
bool feerate_changes_done(const struct fee_states *fee_states)
{
size_t num_feerates = 0;
for (size_t i = 0; i < ARRAY_SIZE(fee_states->feerate); i++) {
num_feerates += (fee_states->feerate[i] != NULL);
}
return num_feerates == 1;
}
void start_fee_update(struct fee_states *fee_states,
enum side opener,
u32 feerate_per_kw)