core-lightning/tests
Rusty Russell 6f015b69fd channeld: don't send feerate spam if we can't set it as high as we want.
@pm47 gave a great bug report showing c-lightning sending the same
UPDATE_FEE over and over, with the final surprise result being that we
blamed the peer for sending us multiple empty commits!

The spam is caused by us checking "are we at the desired feerate?" but
then if we can't afford the desired feerate, setting the feerate we
can afford, even though it's a duplicate.  Doing the feerate cap before
we test if it's what we have already eliminates this.

But the empty commits was harder to find: it's caused by a heuristic in
channel_rcvd_revoke_and_ack:

```
	/* For funder, ack also means time to apply new feerate locally. */
	if (channel->funder == LOCAL &&
	    (channel->view[LOCAL].feerate_per_kw
	     != channel->view[REMOTE].feerate_per_kw)) {
		status_trace("Applying feerate %u to LOCAL (was %u)",
			     channel->view[REMOTE].feerate_per_kw,
			     channel->view[LOCAL].feerate_per_kw);
		channel->view[LOCAL].feerate_per_kw
			= channel->view[REMOTE].feerate_per_kw;
		channel->changes_pending[LOCAL] = true;
	}
```

We assume we never send duplicates, so we detect an otherwise-empty
change using the difference in feerates.  If we don't set this flag,
we will get upset if we receive a commitment_signed since we consider
there to be no changes to commit.

This is actually hard to test: the previous commit adds a test which
spams update_fee and doesn't trigger this bug, because both sides
use the same "there's nothing outstanding" logic.

Fixes: #2701
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-06-09 02:39:05 +00:00
..
data pytest: test starting with db corrupted by dangling peer. 2019-02-21 12:03:54 +01:00
plugins pytest: Add a test for the 'warning' subscription and notification 2019-06-07 01:23:51 +00:00
benchmark.py py-tests: rename 'announce' to 'wait_for_announce' 2018-12-08 15:15:55 -08:00
btcproxy.py pytest: create proper mock failures. 2019-01-29 04:50:01 +00:00
conftest.py pytest: Pass result to fixtures and keep directories of failed tests 2018-08-07 00:54:19 +00:00
fixtures.py pytest: catch more gossip-related errors. 2019-06-03 11:04:25 -07:00
requirements.txt pytest: Update test dependencies to latest version 2019-01-29 00:50:09 +00:00
test_closing.py htlc: Replay unprocessed HTLCs loaded from the DB 2019-06-04 00:27:15 +00:00
test_connection.py channeld: don't send feerate spam if we can't set it as high as we want. 2019-06-09 02:39:05 +00:00
test_db.py db: fix dangling peers on db upgrade. 2019-02-21 12:03:54 +01:00
test_gossip.py gossipd/gossip_store: keep count of deleted entries, don't use bs->count. 2019-06-04 01:29:39 +00:00
test_invoices.py bolt11: fix decoding and encoding of unknown fields. 2019-05-10 11:25:36 +00:00
test_misc.py pytest: cleanup test_funding_reorg_remote_lags 2019-06-07 10:34:34 +02:00
test_pay.py pytest: fix test_hlcs_cltv_only_difference 2019-06-07 10:33:24 +02:00
test_plugin.py pytest: Add a test for the 'warning' subscription and notification 2019-06-07 01:23:51 +00:00
test_wallet.py wallet: clean reserved inputs on startup. 2019-06-06 04:47:44 +00:00
utils.py pytest: test that we unreserve txprepare inputs across shutdown/crash. 2019-06-06 04:47:44 +00:00