Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channeld: don't send multiple update_fee until previous settled. #3325

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ struct peer {

/* Empty commitments. Spec violation, but a minor one. */
u64 last_empty_commitment;

/* When did we last send update_fee? */
u64 last_fee_update_indexes[NUM_SIDES];
};

static u8 *create_channel_announcement(const tal_t *ctx, struct peer *peer);
Expand Down Expand Up @@ -1143,7 +1146,11 @@ static void send_commit(struct peer *peer)
if (feerate > max)
feerate = max;

if (feerate != channel_feerate(peer->channel, REMOTE)) {
/* FIXME: Our feerate logic has a bug when we have multiple
* feerate changes in flight. Don't do that for now. */
if ((peer->next_index[LOCAL] == peer->last_fee_update_indexes[LOCAL]
|| peer->next_index[REMOTE] == peer->last_fee_update_indexes[REMOTE])
&& feerate != channel_feerate(peer->channel, REMOTE)) {
u8 *msg;

if (!channel_update_feerate(peer->channel, feerate))
Expand All @@ -1155,6 +1162,8 @@ static void send_commit(struct peer *peer)
msg = towire_update_fee(NULL, &peer->channel_id,
feerate);
sync_crypto_write(peer->pps, take(msg));
peer->last_fee_update_indexes[LOCAL] = peer->next_index[LOCAL];
peer->last_fee_update_indexes[REMOTE] = peer->next_index[REMOTE];
}
}

Expand Down Expand Up @@ -3152,6 +3161,7 @@ int main(int argc, char *argv[])
/* We actually received it in the previous daemon, but near enough */
peer->last_recv = time_now();
peer->last_empty_commitment = 0;
peer->last_fee_update_indexes[LOCAL] = peer->last_fee_update_indexes[REMOTE] = -1ULL;

/* We send these to HSM to get real signatures; don't have valgrind
* complain. */
Expand Down