core-lightning/channeld
Rusty Russell 88a4502a51 channeld: pause before sending initial channel_update.
The last change exposed a race: the peer sends funding_locked
then immediately sends an update_channel.  channeld used to process
the funding_locked from the peer, tell gossipd about the new
channel, then finally forward the channel_update.

We can have the channel_update hit gossipd before we've told it about
the channel.  It ignores the channel_update for the currently-unknown
channel: we get a 'bad gossip' message, but the immediate symptom
is a timeout in tests/test_closing.py::test_onchain_multihtlc_their_unilateral:

```
node_factory = <pyln.testing.utils.NodeFactory object at 0x7fdf93f42190>
bitcoind = <pyln.testing.utils.BitcoinD object at 0x7fdf940b99d0>

    @pytest.mark.developer("needs DEVELOPER=1 for dev_ignore_htlcs")
    @pytest.mark.slow_test
    def test_onchain_multihtlc_their_unilateral(node_factory, bitcoind):
        """Node pushes a channel onchain with multiple HTLCs with same payment_hash """
>       h, nodes = setup_multihtlc_test(node_factory, bitcoind)

tests/test_closing.py:2938: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_closing.py:2780: in setup_multihtlc_test
    nodes = node_factory.line_graph(7, wait_for_announce=True,
/usr/local/lib/python3.8/dist-packages/pyln/testing/utils.py:1416: in line_graph
    self.join_nodes(nodes, fundchannel, fundamount, wait_for_announce, announce_channels)
/usr/local/lib/python3.8/dist-packages/pyln/testing/utils.py:1394: in join_nodes
    nodes[i + 1].wait_channel_active(scids[i])
/usr/local/lib/python3.8/dist-packages/pyln/testing/utils.py:958: in wait_channel_active
    wait_for(lambda: self.is_channel_active(chanid))
```

Note that we are usually much faster to send between subds than we are
between peers, but during CI this is common, as we're all running on
the same machine.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-02-08 11:15:52 +10:30
..
test common: generalize extract_channel_id(). 2021-12-30 09:50:40 +10:30
channeld.c channeld: pause before sending initial channel_update. 2022-02-08 11:15:52 +10:30
channeld_htlc.h htlcs: add flag to 'fail immediately' 2021-10-23 12:59:13 +02:00
channeld_wire.csv channeld: send channel updates and announcements via lightningd. 2022-02-08 11:15:52 +10:30
commit_tx.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
commit_tx.h dusty-htlcs: enforce limit on dusty htlcs 2021-10-23 12:59:13 +02:00
full_channel.c global: use tal_dup_or_null(). 2021-12-30 14:36:55 +10:30
full_channel.h dusty-htlcs: enforce limit on dusty htlcs 2021-10-23 12:59:13 +02:00
full_channel_error.h dusty-htlcs: enforce limit on dusty htlcs 2021-10-23 12:59:13 +02:00
Makefile connectd: do dev_disconnect logic. 2022-01-20 15:24:06 +10:30
watchtower.c elements: unify overhead calculation. 2022-01-27 12:22:36 +01:00
watchtower.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30