lightning/lightningd
Rusty Russell e59e12dcb6 lightningd: don't forget peer if it's still connected.
In particular, when onchaind finishes with a channel, and we delete it, we
would forget about the peer, even if it's still connected.  That leads to a
surprise if we are activated because of something it sends:

```
2022-07-16T09:07:51.8668176Z lightningd-1 2022-07-16T08:54:32.497Z INFO    022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: Peer transient failure in AWAITING_UNILATERAL: Disconnected
2022-07-16T09:07:51.8668717Z lightningd-1 2022-07-16T08:54:32.497Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-lightningd: Will try reconnect in 1 seconds
2022-07-16T09:07:51.8669323Z lightningd-1 2022-07-16T08:54:32.497Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: Peer has reconnected, state AWAITING_UNILATERAL: connecting subd
2022-07-16T09:07:51.8671225Z lightningd-1 2022-07-16T08:54:32.497Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: Telling connectd to send error 001185a48d443eae6fbcc679accd4d497c4183b711f2cd204c0b50acd3cd76fda08d00936368616e6e656c643a207265636569766564204552524f52206572726f72206368616e6e656c20383561343864343433656165366662636336373961636364346434393763343138336237313166326364323034633062353061636433636437366664613038643a20466f726369626c7920636c6f7365642062792060636c6f73656020636f6d6d616e642074696d656f7574
2022-07-16T09:07:51.8671786Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: peer_in WIRE_GOSSIP_TIMESTAMP_FILTER
2022-07-16T09:07:51.8672270Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-hsmd: Got WIRE_HSMD_ECDH_REQ
2022-07-16T09:07:51.8673027Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-onchaind-chan#1: billboard: All outputs resolved: waiting 0 more blocks before forgetting channel
2022-07-16T09:07:51.8673419Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   gossipd: REPLY WIRE_GOSSIPD_GET_ADDRS_REPLY with 0 fds
2022-07-16T09:07:51.8673954Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: peer_out WIRE_GOSSIP_TIMESTAMP_FILTER
2022-07-16T09:07:51.8674298Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   hsmd: Client: Received message 1 from client
2022-07-16T09:07:51.8674811Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-gossipd: seeker: chosen as startup peer
2022-07-16T09:07:51.8675330Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-connectd: Activating for message WIRE_ERROR
2022-07-16T09:07:51.8675825Z lightningd-2 2022-07-16T08:54:32.497Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-hsmd: Got WIRE_HSMD_ECDH_REQ
...
2022-07-16T09:07:51.9503144Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: FATAL SIGNAL 11 (version 6e6b41d)
2022-07-16T09:07:51.9503563Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: common/daemon.c:38 (send_backtrace) 0x5620882dbffb
2022-07-16T09:07:51.9503970Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: common/daemon.c:46 (crashdump) 0x5620882dc04d
2022-07-16T09:07:51.9504534Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 ((null)) 0x7ffb3abdf08f
2022-07-16T09:07:51.9504973Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: lightningd/peer_control.c:1378 (peer_spoke) 0x5620882aedd7
2022-07-16T09:07:51.9505418Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: lightningd/connect_control.c:492 (connectd_msg) 0x56208828e9db
2022-07-16T09:07:51.9505835Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: lightningd/subd.c:557 (sd_msg_read) 0x5620882bd89a
2022-07-16T09:07:51.9506236Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0x5620883318d4
2022-07-16T09:07:51.9506618Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0x562088331da1
2022-07-16T09:07:51.9507021Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0x562088331e3e
2022-07-16T09:07:51.9507428Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: ccan/ccan/io/poll.c:453 (io_loop) 0x5620883337d3
2022-07-16T09:07:51.9507945Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: lightningd/io_loop_with_timers.c:22 (io_loop_with_timers) 0x5620882969f5
2022-07-16T09:07:51.9508368Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: lightningd/lightningd.c:1190 (main) 0x56208829a7bb
2022-07-16T09:07:51.9508804Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: ../csu/libc-start.c:308 (__libc_start_main) 0x7ffb3abc0082
2022-07-16T09:07:51.9509172Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x56208827d32d
2022-07-16T09:07:51.9509552Z lightningd-2 2022-07-16T08:54:32.737Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffffffffffffff
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-07-18 20:50:04 -05:00
..
test lightningd: provide peer address for reconnect if connect fails. 2022-07-18 20:50:04 -05:00
.gitignore Ignore all the deamon inside the git history 2021-10-28 15:51:38 +02:00
bitcoind.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
bitcoind.h common: use bitcoin_outpoint. 2021-10-15 12:09:36 +02:00
chaintopology.c lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
chaintopology.h lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
channel_control.c connectd: add counters to each peer connection. 2022-07-18 20:50:04 -05:00
channel_control.h lightningd: hand fds to connectd, not receive them from connectd. 2022-07-18 20:50:04 -05:00
channel_state.h channel-state: add two new states, for dualopend 2021-01-10 13:44:04 +01:00
channel.c lightningd: remove 'connected' flag from channel structure. 2022-07-18 20:50:04 -05:00
channel.h lightningd: remove 'connected' flag from channel structure. 2022-07-18 20:50:04 -05:00
closing_control.c lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
closing_control.h patch lightningd-peer-fds.patch 2022-01-20 15:24:06 +10:30
coin_mvts.c balance_snapshot: don't count unconfirmed utxos 2022-03-05 15:12:12 +10:30
coin_mvts.h coin_mvt: tiny, dont import lightningd header 2022-02-07 13:02:09 +10:30
connect_control.c lightningd: provide peer address for reconnect if connect fails. 2022-07-18 20:50:04 -05:00
connect_control.h lightningd: provide peer address for reconnect if connect fails. 2022-07-18 20:50:04 -05:00
datastore.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
dual_open_control.c connectd: add counters to each peer connection. 2022-07-18 20:50:04 -05:00
dual_open_control.h lightningd: hand fds to connectd, not receive them from connectd. 2022-07-18 20:50:04 -05:00
feerate.c lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
feerate.h lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
gossip_control.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
gossip_control.h connectd: remove second gossip fd. 2022-02-08 11:15:52 +10:30
hsm_control.c lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
hsm_control.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
htlc_end.c lightningd: fix overzealous check in htlc_out_check: 2022-04-20 16:30:05 +09:30
htlc_end.h coin_mvt: record fees for an outbound htlc 2021-12-28 04:42:42 +10:30
htlc_set.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
htlc_set.h Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES 2020-09-08 09:42:00 +09:30
invoice.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
invoice.h Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES 2020-09-08 09:42:00 +09:30
io_loop_with_timers.c database: pull out database code into a new module 2022-03-05 15:03:34 +10:30
io_loop_with_timers.h lightningd/io_loop_with_timers.c: Move mainloop to its own source file, have chaintopology use it. 2019-05-31 17:57:10 +02:00
jsonrpc.c common/json_stream: make json_add_jsonstr take a length. 2022-07-17 08:51:02 +09:30
jsonrpc.h common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
lightningd.c lightningd: re-transmit all closing transactions on startup. 2022-07-14 12:40:57 -05:00
lightningd.h lightningd: multiple log-file options allow more than one log output. 2022-06-27 17:21:35 +09:30
log_status.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
log_status.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
log.c common/json_stream.c: provide explicit json_add_primitive_fmt and json_add_str_fmt routines. 2022-07-15 12:24:00 -05:00
log.h options: let log-level subsystem filter also cover nodeid. 2022-07-09 09:59:52 +09:30
Makefile lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
memdump.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
memdump.h lightningd: simplify memleak code. 2022-03-10 09:40:09 +10:30
notification.c common/json_stream.c: provide explicit json_add_primitive_fmt and json_add_str_fmt routines. 2022-07-15 12:24:00 -05:00
notification.h lightningd: add "style" to listforwards. 2022-03-31 19:38:05 +10:30
offer.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
onchain_control.c lightningd: Add RPC for populating DB with stub channels and set an error on reconnecting 2022-07-14 12:24:48 -05:00
onchain_control.h onchaind: remove 'is_replay' logic 2021-12-28 04:42:42 +10:30
onion_message.c lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
onion_message.h common: remove support for pre v0.10.2 onionmessages. 2021-12-01 05:44:28 +10:30
opening_common.c lightningd: set cid correctly in peer->uncommitted_channel. 2022-07-18 20:50:04 -05:00
opening_common.h lightningd: set cid correctly in peer->uncommitted_channel. 2022-07-18 20:50:04 -05:00
opening_control.c connectd: add counters to each peer connection. 2022-07-18 20:50:04 -05:00
opening_control.h connectd: hold peer until we're interested. 2022-03-23 13:20:12 +10:30
options.c options: set DNS port to network default if not specified 2022-07-17 23:26:07 +02:00
options.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
pay.c lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
pay.h lightningd: use our cached channel_update for errors instead of asking gossipd. 2022-02-08 11:15:52 +10:30
peer_control.c lightningd: don't forget peer if it's still connected. 2022-07-18 20:50:04 -05:00
peer_control.h lightningd: don't kill subds immediately on disconnect. 2022-07-18 20:50:04 -05:00
peer_fd.c subdaemons: remove gossipd fd from per-peer daemons. 2022-02-08 11:15:52 +10:30
peer_fd.h subdaemons: remove gossipd fd from per-peer daemons. 2022-02-08 11:15:52 +10:30
peer_htlcs.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
peer_htlcs.h lightningd: extra sanity checks and rescue attempts for missing HTLCs. 2022-03-31 13:40:27 +10:30
ping.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
plugin_control.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
plugin_control.h plugins: add command field to subcommand output. 2021-06-25 09:49:33 +09:30
plugin_hook.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
plugin_hook.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
plugin.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
plugin.h lightningd: cleanup obsolete plugins->shutdown flag 2021-12-14 09:33:10 +10:30
routehint.c common: clean up json routine locations. 2022-07-15 12:24:00 -05:00
routehint.h invoice: overhaul routehints to use topology.listincoming, cleanup. 2021-06-16 10:29:17 +09:30
signmessage.c lightningd/json.h: remove. 2022-07-15 12:24:00 -05:00
subd.c options: let log-level subsystem filter also cover nodeid. 2022-07-09 09:59:52 +09:30
subd.h subd: make channel/peer own the subd. 2022-03-30 06:27:52 +10:30
watch.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
watch.h common: use bitcoin_outpoint. 2021-10-15 12:09:36 +02:00