peer: don't close due to too low fees if we're already closed.

This fixes half of #59 (the part which crashes).  It doesn't fix the
fact that we should never be doing this for testnet.

Reported-by: Thomas Daede <daede003@umn.edu>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-11-06 14:44:16 +10:30
parent 8949290794
commit ab11322b39

View file

@ -3035,7 +3035,8 @@ static enum watch_result anchor_depthchange(struct peer *peer,
* timely manner (see "Risks With HTLC Timeouts").
*/
/* FIXME: BOLT should say what to do if it can't! We drop conn. */
if (peer->local.commit->cstate->fee_rate < get_feerate(peer->dstate)) {
if (!state_is_onchain(peer->state) && !state_is_error(peer->state)
&& peer->local.commit->cstate->fee_rate < get_feerate(peer->dstate)) {
log_broken(peer->log, "fee rate %"PRIu64" lower than %"PRIu64,
peer->local.commit->cstate->fee_rate,
get_feerate(peer->dstate));