Commit graph

4500 commits

Author SHA1 Message Date
Rusty Russell
1cbc96f0d9 lightningd: remember when we started closing channel.
This lets us maintain a reasonable 2 week target for commitment tx.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-26 14:49:36 +10:30
Rusty Russell
5192eebef9 lightningd: wire channel closing tx through channel_fail_permanent.
Cleans up the API: we have two functions now, one which is explicitly for
"I'm failing this because I saw this tx onchain".

Now we can correctly report the tx which closed the channel (previously
we would always report our own tx(s)!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `close` now correctly reports the txid of the remote onchain unilateral tx if it races with a peer close.
Changelog-Fixed: Protocol: we no longer try to spend anchors if a commitment tx is already mined (reported by @niftynei).
Fixes: #7526
2024-11-25 20:23:21 +10:30
Rusty Russell
bfb94fe0c3 lightnind: make channel_set_state string arg const.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 20:23:21 +10:30
Rusty Russell
656ac34756 lightningd: make close_txs parameter to resolve_close_command const.
We don't need to change these txs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 20:23:21 +10:30
niftynei
193b4425ab nit: spelling fix 2024-11-25 20:23:21 +10:30
Rusty Russell
faf7ae6ad4 pytest: add test for connection ratelimiting.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Rusty Russell
15950bb7d4 connectd: reconnect for non-transient connections.
Rather than have lightningd call us repeatedly to try to connect, have
it tell us what peers are transient and aren't, and connectd will
automatically try to maintain that connection.

There's a new "downgrade_peer" message to tell it a peer is now
transient: to make it non-transient we simply tell connectd to
connect as a non-transient.

The first time, I missed that dual_open_control does its own state
transitions :(

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: `connectd` now handles maintaining/reconnecting to important peers, and we remember the last successful address we connected to.
2024-11-25 15:39:13 +10:30
Rusty Russell
ff290b19c9 recovery: save last_known_addr for peer if we know it.
This is more useful than the last address, which may be it connecting
to us.  And use it when we restore it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Rusty Russell
22a481fbaa common: routine to make wireaddr_internal from wireaddr.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Rusty Russell
68feb55dbf wallet: save last known address.
If we connected out, remember that address.  We always remember the last
address, but that may be an incoming address.  This is explicitly the last
outgoing address which worked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Rusty Russell
64af5db45c lightningd: generalize peer_any_channel to filter on entire channel, not just state.
We're going to use this to ask if there are any channels which make it
important to reconnect to the peer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Rusty Russell
4ee59e7a49 connectd: expose --dev-no-reconnect and --dev-fast-reconnect options.
Once connectd is controlling reconnections, it'll need these.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Rusty Russell
c6fce50951 gossipd: don't tell connectd what address to connect to.
In fact, only 951 of 17419 (5%) of node announcements are missing an address
(and gossipd doesn't know if we can connect to Tor addresses anyway) so
just check it *has* a node_announcement.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Rusty Russell
23dc10cf81 connectd: get our own addresses to contact node from node_announcements.
Let lightningd feed us hints to try first, but we can extract the
addresses from node_announcement messages ourselves.

(Lightningd used to ask gossipd on our behalf: this is far simpler!)

One side effect of this is that we don't hand back address hints given to us
by lightningd: it would use these again for reconnecting.  This is breaks
test_sendpay_grouping, so we disable it temporarily.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-25 15:39:13 +10:30
Christian Decker
57b9648d30 common: Resume the startup trace after exiting io_loop
This was a bit harder to identify: during an `io_loop` run we suspend
the current span before handing over to `io_loop`, and later when a callback
is called we resume the span again. Depending on how we return from
the `io_loop` instance that is used to drive the startup, we either
have resumed the last span, or we don't. Since we start a span before
`io_loop` and want it to be emitted afterwards, we need to take care
of the case where we returned from a callback that did not resume, and
therefore the current context is empty.

Making `trace_span_resume` idempotent means we can just resume it
manually.

Ideally we'd push the suspend / resume logic down into `io_loop`
itself, and then we'd have just one place. Maybe suspend and resume
callbacks that can be configured in `io_loop`?
2024-11-24 10:24:31 +10:30
Matt Whitlock
7a2006842f lightningd/test/Makefile: add missing dependency on header_versions_gen.h
lightningd/test/run-find_my_abspath.c includes ../lightningd.c, which includes
header_versions_gen.h, a generated header file.

lightningd/Makefile correctly declares that lightningd/lightningd.o depends on
header_versions_gen.h, but lightningd/test/Makefile lacks any such declaration
regarding lightningd/test/run-find_my_abspath.c, which leads to build failure:

In file included from lightningd/test/run-find_my_abspath.c:5:
lightningd/test/../lightningd.c:64:10: fatal error: header_versions_gen.h: No such file or directory
   64 | #include <header_versions_gen.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~

Declare the missing dependency in lightningd/test/Makefile so that Make will
ensure that header_versions_gen.h is generated before it attempts to build
lightningd/test/run-find_my_abspath.o.

Changelog-None
2024-11-23 13:03:00 +01:00
Alex Myers
363b721cd3 gossipd: use autoconnect-seeker-peers setting 2024-11-22 15:21:45 +10:30
Alex Myers
dc878dc937 lightningd: add option for minimum seeker autoconnect peers
Changelog-added: Added option --autoconnect-seeker-peers, allowing seeker to reach out to new nodes for additional gossip.
2024-11-22 15:21:45 +10:30
Alex Myers
dff5c893e7 gossipd: seeker: select random peer and tell lightningd
This does not validate a node announcement and address, but it
does select a node at random from the gossmap and asks lightningd
to attempt a connection to it.
2024-11-22 15:21:45 +10:30
Alex Myers
7fc214a67f gossipd: add request to connect to new gossip peer
Gossipd uses this to ask lightningd -> connectd to initiate
a connection to a new gossip peer.  This can be used when
there are insufficient peers already connected to gossip with.

Changelog-Changed: Gossipd can now request connections to additional nodes for improved gossip sync
2024-11-22 15:21:45 +10:30
Rusty Russell
799acc90e6 lightningd: tell gossipd channel is closed if it tells us about our channel and is wrong.
While we have (I hope!) fixed the underlying sync problem, this can still happen with
older gossip.  So now we tell it the channel is dead, so it won't happen more than once.

Fixes: #7703
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-21 15:42:06 +10:30
Dusty Daemon
6d63e68e99 splice: Update messages to spec
Changelog-Changed: Splicing moved from test numbers to spec numbers.
2024-11-21 14:15:36 +10:30
Dusty Daemon
03d7d8f45a splice: Update funding pubkey on splice lock
Set the remote funding pubkey on both lightningd and channeld when mutual splice lock is achieved.

This will be needed once rotating funding keys is enabled during splicing

Changelog-None.
2024-11-21 14:15:36 +10:30
Dusty Daemon
5f330b3cd6 channeld: tx_abort should skip reestablish
`tx_abort` should not send reestablish message and instead go into ‘reconnect only mode’

Changelog-None
2024-11-21 14:15:36 +10:30
Dusty Daemon
42440e3bee splice: Pass remote_funding between ld and channeld
Update lightningd and channeld interface to pass the remote funding pubkey back and forth to both daemons.

Changelog-None
2024-11-21 14:15:36 +10:30
Dusty Daemon
560ca00a2b splice: Add remote_funding to database
Enable storing the remote funding pubkey in DB if the channel peer decides to change it during splicing. It needs to be in DB incase of restarts mid-splice.

Changelog-None
2024-11-21 14:15:36 +10:30
Dusty Daemon
4b3643d209 splice: Clean up error messages for RPC
Added and updated error messages when splicing to make it more clear to the user why a splice is failing.

Changelog-Changed: Improved error messaging for splice commands.
2024-11-21 14:15:36 +10:30
Rusty Russell
1160e35669 lightningd: send errors inside blinded paths correctly.
Don't reply with update_fail_malformed_htlc, even though WIRE_INVALID_ONION_BLINDING
has BADONION set.  Fail it with a normal error message.

This fixes a known FIXME.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Protocol: entry to blinded paths return more useful errors (e.g if it's the final node, you get a real error, otherwise you get invalid_onion_blinding).
2024-11-20 12:29:27 +01:00
Rusty Russell
e38f5d8c27 common: provide readable explanation when onion payload is invalid.
I had to use fprintf, which is terrible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-20 12:29:27 +01:00
Vincenzo Palazzo
6f0dbbb20f bolt12: allow to inject payer_metadata
Payer metadata is a field that controls the payer ID
provided during the fetchinvoice process.

There are use cases where this is highly useful, such as
proving that the payer has paid for the correct item.

Imagine visiting a merchant's website to pay for multiple offers, where
one of these offers is a default offer (with no description and no set amount).

In this scenario, the merchant could claim not to have received
payment for a specific item. Since the same offer may be used to
fetch invoices for different products, there needs to be a way to
identify which product the invoice corresponds to.

With this commit, it will be possible to inject payer metadata,
which helps solve the issue described above.

For example, possible payer metadata could be `to_hex(b"{payer_node_id}.{product_id}.{created_at}")`.

Changelog-Added: JSON-RPC: `fetchinvoice` allows setting invreq_metadata via `payer_metadata` parameter.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-11-19 22:54:22 +01:00
Rusty Russell
6c347a4050 pytest: fix flake in test_gossip_pruning
We actually pruned before we got all the channels.  Extend the pruning time,
which unfortunately makes the test slower.

```
2024-11-18T02:13:11.7013278Z node_factory = <pyln.testing.utils.NodeFactory object at 0x7ff72969e820>
2024-11-18T02:13:11.7014386Z bitcoind = <pyln.testing.utils.BitcoinD object at 0x7ff72968fe20>
2024-11-18T02:13:11.7014996Z 
2024-11-18T02:13:11.7015271Z     def test_gossip_pruning(node_factory, bitcoind):
2024-11-18T02:13:11.7016222Z         """ Create channel and see it being updated in time before pruning
2024-11-18T02:13:11.7017037Z         """
2024-11-18T02:13:11.7017871Z         l1, l2, l3 = node_factory.get_nodes(3, opts={'dev-fast-gossip-prune': None,
2024-11-18T02:13:11.7018971Z                                                      'allow_bad_gossip': True})
2024-11-18T02:13:11.7019634Z     
2024-11-18T02:13:11.7020236Z         l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
2024-11-18T02:13:11.7021153Z         l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
2024-11-18T02:13:11.7021806Z     
2024-11-18T02:13:11.7022226Z         scid1, _ = l1.fundchannel(l2, 10**6)
2024-11-18T02:13:11.7022886Z         scid2, _ = l2.fundchannel(l3, 10**6)
2024-11-18T02:13:11.7023458Z     
2024-11-18T02:13:11.7023907Z         mine_funding_to_announce(bitcoind, [l1, l2, l3])
2024-11-18T02:13:11.7025183Z         l1_initial_cupdate_timestamp = only_one(l1.rpc.listchannels(source=l1.info['id'])['channels'])['last_update']
2024-11-18T02:13:11.7026179Z     
2024-11-18T02:13:11.7027358Z         # Get timestamps of initial updates, so we can ensure they change.
2024-11-18T02:13:11.7028171Z         # Channels should be activated locally
2024-11-18T02:13:11.7029326Z >       wait_for(lambda: [c['active'] for c in l1.rpc.listchannels()['channels']] == [True] * 4)
```

We can see in logs, it actually started pruning already:

```
2024-11-18T02:13:11.9622477Z lightningd-1 2024-11-18T01:52:03.570Z DEBUG   gossipd: Pruning channel 105x1x0 from network view (ages 1731894723 and 0)
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-19 17:51:18 +10:30
Rusty Russell
1e8cbf2645 lightningd: don't access after free on plugin crash
tests/test_plugin.py::test_important_plugin does this, and it's inelegant:

```
lightningd-1 2024-11-18T07:33:09.433Z **BROKEN** plugin-fail_by_itself.py: Plugin marked as important, shutting down lightningd!
lightningd-1 2024-11-18T07:33:09.451Z DEBUG   lightningd: io_break: lightningd_exit
lightningd-1 2024-11-18T07:33:09.533Z DEBUG   connectd: REPLY WIRE_CONNECTD_START_SHUTDOWN_REPLY with 0 fds
lightningd-1 2024-11-18T07:33:09.575Z DEBUG   lightningd: io_break: connectd_start_shutdown_reply
lightningd-1 2024-11-18T07:33:09.802Z DEBUG   lightningd: Looking for [autoclean,failedforwards,num]
{'github_repository': 'ElementsProject/lightning', 'github_sha': '0729de783e95c5208b1706f7d27b23904596bb71', 'github_ref': 'refs/pull/7835/merge', 'github_ref_name': 'HEAD', 'github_run_id': 11887300979, 'github_head_ref': 'guilt/fix-flakes8', 'github_run_number': 11566, 'github_base_ref': 'master', 'github_run_attempt': '1', 'testname': 'test_important_plugin', 'start_time': 1731915163, 'end_time': 1731915190, 'outcome': 'fail'}
----------------------------- Captured stderr call -----------------------------
No plugin for askrene-create-layer ?
Lost connection to the RPC socket.Reading JSON input: Connection reset by peerReading JSON input: Connection reset by peerReading JSON input: Connection reset by peerReading JSON input: Connection reset by peer
--------------------------- Captured stdout teardown ---------------------------
------------------------------- Valgrind errors --------------------------------
Valgrind error file: valgrind-errors.28639
==28639== Invalid read of size 8
==28639==    at 0x168310: command_exec (jsonrpc.c:808)
==28639==    by 0x168A98: rpc_command_hook_final (jsonrpc.c:954)
==28639==    by 0x1AD48C: plugin_hook_call_next (plugin_hook.c:196)
==28639==    by 0x1AD407: plugin_hook_callback (plugin_hook.c:183)
==28639==    by 0x1A6074: plugin_response_handle (plugin.c:663)
==28639==    by 0x1A62F0: plugin_read_json_one (plugin.c:775)
==28639==    by 0x1A652D: plugin_read_json (plugin.c:826)
==28639==    by 0x390200: next_plan (io.c:60)
==28639==    by 0x390E56: do_plan (io.c:422)
==28639==    by 0x390EBD: io_ready (io.c:439)
==28639==    by 0x3932F1: io_loop (poll.c:455)
==28639==    by 0x1ABBE4: shutdown_plugins (plugin.c:2588)
==28639==  Address 0x5d25a20 is 48 bytes inside a block of size 88 free'd
==28639==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==28639==    by 0x3A31FB: del_tree (tal.c:456)
==28639==    by 0x3A317B: del_tree (tal.c:447)
==28639==    by 0x3A34DC: tal_free (tal.c:532)
==28639==    by 0x1ABAF3: shutdown_plugins (plugin.c:2575)
==28639==    by 0x16E0D3: main (lightningd.c:1514)
==28639==  Block was alloc'd at
==28639==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==28639==    by 0x3A2BCA: allocate (tal.c:256)
==28639==    by 0x3A3252: tal_alloc_ (tal.c:473)
==28639==    by 0x1A815E: plugin_rpcmethod_add (plugin.c:1425)
==28639==    by 0x1A83F9: plugin_rpcmethods_add (plugin.c:1470)
==28639==    by 0x1A965A: plugin_parse_getmanifest_response (plugin.c:1850)
==28639==    by 0x1A971F: plugin_manifest_cb (plugin.c:1872)
==28639==    by 0x1A6074: plugin_response_handle (plugin.c:663)
==28639==    by 0x1A62F0: plugin_read_json_one (plugin.c:775)
==28639==    by 0x1A652D: plugin_read_json (plugin.c:826)
==28639==    by 0x390200: next_plan (io.c:60)
==28639==    by 0x390E56: do_plan (io.c:422)
==28639==
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-19 17:51:18 +10:30
Rusty Russell
1b413502e0 lightningd: deprecate experimental-offers option.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: Config: `experimental-offers` (it's now the default).
2024-11-18 10:42:54 +01:00
Rusty Russell
ca41414da4 offers: make it the default.
Changelog-Changed: offers: bolt12 now enabled by default (finally!)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 10:42:54 +01:00
Rusty Russell
c93153ec37 lightningd: allow builtin plugins to be stopped.
These are automatically marked "important", in the sense that we won't startup
if they are not working, but this wasn't meant to disallow stopping them.

Changelog-Changed: JSON-RPC: built-in plugins can now be stopped using "plugin stop".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
c715253af7 xpay: option to steal easy commands from pay.
Note: won't work with grpc (or probably other tools), since the output
is different.  But good for testing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Config: option `xpay-handle-pay` can be used to call xpay when pay is used in many cases (but output is different from pay!)
2024-11-18 11:03:26 +10:30
Rusty Russell
611e430754 lightningd: injectpaymentonion should fail on re-attempts.
This is clearer than transparently succeeding: the user might think they
paid twice.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
d6152fdc40 lightningd: don't include empty error in onion returned on failed injectpaymentonion.
fail->msg can be NULL for local failures (the error message itself is more informative
in this case).  Use the generic "something went wrong" message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
ef475db478 common: sphinx_path_new to take explicit len.
Useful if associated_data is not a tal pointer (xpay wants this).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-18 11:03:26 +10:30
Rusty Russell
80357911fb lightningd: fix clang 19 compile error.
```
Ubuntu clang version 19.1.0 (++20240901083933+6d7e428df611-1~exp1~20240901084058.28)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin

./configure CC=clang-19
make -j17
<snip>
cc lightningd/offer.c
cc lightningd/signmessage.c
lightningd/subd.c:945:16: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
  945 |         char permfail[strlen("PERMFAIL")];
      |                       ^~~~~~~~~~~~~~~~~~
cc wallet/db.c
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: build: fix overzealous warning from clang 19.
2024-11-17 22:36:04 +10:30
Rusty Russell
6da97e6461 wallet: save keytype when issuing new address.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 20:27:13 +10:30
Rusty Russell
13af9bcfe7 lightningd: use P2TR for onchain tx spends.
Both for HTLC txs and the to-self outputs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Wallet: Taproot addresses are used for unilateral-close change addresses.
2024-11-17 20:27:13 +10:30
Rusty Russell
836204b1f2 lightningd: use P2TR for anchor spends.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 20:27:13 +10:30
Rusty Russell
ad1e9f7979 onchaind: don't get final_key_idx.
onchaind used to make its own txs, but doesn't any more.  This
parameter is useless.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 20:27:13 +10:30
Rusty Russell
c4cbb8671a lightningd: actually deprecate old close fields.
Changelog-Deprecated: `close` `tx` and `txid` field (use `txs` and `txids`)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 16:04:06 +10:30
Dusty Daemon
809f3b01d9 close: Print multiple txs; Fixes #6467
Changelog-Changed: `close` now outputs txs & txids of all closing transactions (splice candidates can cause there to be multiple).
2024-11-17 16:04:06 +10:30
Rusty Russell
fcebb33180 lightningd: deprecate decodepay.
It only works on BOLT11, and has long been replaced by the more
generic "decode".

Removing it will stop the confusion!

(Note: documentation claims it was introduced in 23.08, but that was
 wrong, as it's been in CLN since the beginning).

[ Fixup from: niftynei <niftynei@gmail.com> ]
Fixes: https://github.com/ElementsProject/lightning/issues/6419
Changelog-Deprecated: JSON-RPC: `decodepay`: use `decode`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:21:23 +10:30
Rusty Russell
fffb381a40 lightningd: help memleak scan into replay_tx hash table to avoid false positives.
```
**BROKEN** lightningd: MEMLEAK: 0x5557327d1428
**BROKEN** lightningd:   label=lightningd/onchain_control.c:352:struct replay_tx
**BROKEN** lightningd:   alloc:
**BROKEN** lightningd:     /home/runner/work/lightning/lightning/ccan/ccan/tal/tal.c:488 (tal_alloc_)
**BROKEN** lightningd:     /home/runner/work/lightning/lightning/lightningd/onchain_control.c:352 (replay_watch_tx)
**BROKEN** lightningd:     /home/runner/work/lightning/lightning/lightningd/onchain_control.c:1816 (onchaind_funding_spent)
**BROKEN** lightningd:     /home/runner/work/lightning/lightning/lightningd/onchain_control.c:1860 (onchaind_replay_channels)
**BROKEN** lightningd:     /home/runner/work/lightning/lightning/lightningd/lightningd.c:1407 (main)
**BROKEN** lightningd:   parents:
**BROKEN** lightningd:     lightningd/onchain_control.c:1856:struct replay_tx_hash
**BROKEN** lightningd:     lightningd/lightningd.c:112:struct lightningd
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30
Rusty Russell
cac20129c6 lightningd: don't crash if replaying blocks for onchaind during shutdown.
```
lightningd-1 2024-11-15T04:06:47.660Z UNUSUAL lightningd: JSON-RPC shutdown
lightningd-1 2024-11-15T04:06:47.665Z DEBUG   lightningd: io_break: start_json_stream
lightningd-1 2024-11-15T04:06:47.666Z DEBUG   lightningd: io_loop_with_timers: main
lightningd-1 2024-11-15T04:06:47.672Z DEBUG   connectd: REPLY WIRE_CONNECTD_START_SHUTDOWN_REPLY with 0 fds
lightningd-1 2024-11-15T04:06:47.674Z DEBUG   lightningd: io_break: connectd_start_shutdown_reply
lightningd-1 2024-11-15T04:06:47.680Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-onchaind-chan#1: Status closed, but not exited. Killing
lightningd-1 2024-11-15T04:06:47.715Z **BROKEN** lightningd: FATAL SIGNAL 11 (version e627dbf-modded)
------------------------------- Valgrind errors --------------------------------
Valgrind error file: valgrind-errors.43310
==43310== Invalid read of size 8
==43310==    at 0x1B5717: subd_send_msg (subd.c:842)
==43310==    by 0x17563A: onchain_tx_depth (onchain_control.c:177)
==43310==    by 0x175E92: replay_block (onchain_control.c:391)
==43310==    by 0x12E30C: getrawblockbyheight_callback (bitcoind.c:506)
==43310==    by 0x1A5AC0: plugin_response_handle (plugin.c:663)
==43310==    by 0x1A5D3C: plugin_read_json_one (plugin.c:775)
==43310==    by 0x1A5F79: plugin_read_json (plugin.c:826)
==43310==    by 0x38F320: next_plan (io.c:60)
==43310==    by 0x38FF76: do_plan (io.c:422)
==43310==    by 0x38FFDD: io_ready (io.c:439)
==43310==    by 0x392411: io_loop (poll.c:455)
==43310==    by 0x1AB630: shutdown_plugins (plugin.c:2588)
==43310==  Address 0x58 is not stack'd, malloc'd or (recently) free'd
==43310== 
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-17 14:09:10 +10:30
Rusty Russell
d57accfca7 lightningd: wait for onchaind to ack new spends before continuing replay.
Christian noted that if we don't do this we could flood onchaind with messages:
particularly in Greenlight where the HSM (remote) may delay indefinitely, so
onchaind doesn't process messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-13 14:44:03 +10:30