Commit Graph

4565 Commits

Author SHA1 Message Date
Rusty Russell
d40da2b671 lightningd: make sure we register all addresses at opening if peer doesn't support OPT_SHUTDOWN_ANYSEGWIT.
We select the close key index at opening time, but the non-DF code didn't correctly register the
address as possibly used for P2WPKH for older nodes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: wallet: we could miss our own returned outputs on mutual closes if peer doesn't support option_shutdown_anysegwit (you will still need to rescan after update, if this happened to you!)
Reported-by: Grubles
2025-04-02 11:22:54 +10:30
Rusty Russell
6a81f0733a wallet: don't assume wally_tx outputs tal_bytelen(script) is the same as script_len.
It seems to be here, but it wouldn't have to be, so use the explicit length.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-04-02 11:22:54 +10:30
Rusty Russell
e82f0c42f3 lightningd: don't spam logs on dangling outgoing HTLCs.
We pre-close incoming under some circumstances, so this does happen (it
didn't when this code was written).  Don't walk all the HTLCs complaining
about them in this case, and don't freak out.

Changelog-Fixed: lightningd: incorrect spamming of log and potential crash on testnet case of duplicate HTLCs and slow closing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fixes: https://github.com/ElementsProject/lightning/issues/8176
2025-04-02 11:22:39 +10:30
Rusty Russell
19f76e1f1f lightningd: fix anchorspend HTLC deadline logic.
It's not the *outgoing* HTLC which sets the deadline, it's the incoming.

Reported-by: @whitslack
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Protocol: Egregious anchor fee paid for unilateral close txs due to HTLC timeouts; it's not as urgent as our code made out!
2025-04-01 18:29:08 -05:00
Rusty Russell
1f0506352e lightningd: allow bitcoind_getrawblockbyheight callback to free call struct.
Use the indirect-free trick, otherwise this can happen:

```
2025-03-28T10:46:16.437Z BROKEN lightningd: FATAL SIGNAL 6 (version v25.02)
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: common/daemon.c:41 (send_backtrace) 0x6447525af68c
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: common/daemon.c:78 (crashdump) 0x6447525af6db
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 ((null)) 0x7783e2c4532f
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ./nptl/pthread_kill.c:44 (__pthread_kill_implementation) 0x7783e2c9eb2c
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ./nptl/pthread_kill.c:78 (__pthread_kill_internal) 0x7783e2c9eb2c
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ./nptl/pthread_kill.c:89 (__GI___pthread_kill) 0x7783e2c9eb2c
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ../sysdeps/posix/raise.c:26 (__GI_raise) 0x7783e2c4527d
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ./stdlib/abort.c:79 (__GI_abort) 0x7783e2c288fe
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ccan/ccan/tal/tal.c:95 (call_error) 0x644752675535
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ccan/ccan/tal/tal.c:169 (check_bounds) 0x6447526755de
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ccan/ccan/tal/tal.c:180 (to_tal_hdr) 0x644752675618
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: ccan/ccan/tal/tal.c:525 (tal_free) 0x644752676001
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: lightningd/bitcoind.c:509 (getrawblockbyheight_callback) 0x64475252c01b
2025-03-28T10:46:16.437Z BROKEN lightningd: backtrace: lightningd/plugin.c:661 (plugin_response_handle) 0x64475257be0a
```

Changelog-Fixed: lightningd: occasional crash on bitcoind callback.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-04-01 13:29:28 -05:00
Rusty Russell
edb386558c lightningd: avoid high memory usage spike at startup.
I saw this while watching top, and tracked it down.  We load all the
plugins to checksum them at startup:

```
$ ms_print massif.out.3312805 | head -n 50
--------------------------------------------------------------------------------
Command:            lightningd/lightningd.real --developer --log-level=trace --cltv-delta=6 --cltv-final=5 --watchtime-blocks=5 --rescan=1 --disable-dns --lightning-dir=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/ --addr=127.0.0.1:46337 --allow-deprecated-apis=false --network=regtest --ignore-fee-limits=false --bitcoin-rpcuser=rpcuser --bitcoin-rpcpassword=rpcpass --bitcoin-datadir=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/ --dev-fast-gossip --dev-bitcoind-poll=1 --log-file=- --log-file=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/log --log-prefix=lightningd-1  --dev-fail-on-subdaemon-fail --dev-no-reconnect --autoconnect-seeker-peers=0 --subdaemon=channeld:../tests/plugins/channeld_fakenet --dev-throttle-gossip --grpc-port=37819 --dev-crash-after=3600 --bitcoin-rpcport=51623
Massif arguments:   (none)
ms_print arguments: massif.out.3312805
--------------------------------------------------------------------------------

    MB
446.5^#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#    :: : ::@@:@:::::::::::::::::::::::::::@@::::::::::::::@::::@:::::::
   0 +----------------------------------------------------------------------->Gi
     0                                                                   75.66

Number of snapshots: 57
 Detailed snapshots: [1 (peak), 2, 10, 12, 33, 45, 49]

--------------------------------------------------------------------------------
  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
--------------------------------------------------------------------------------
  0              0                0                0             0            0
  1    295,677,530      468,189,872      447,087,069    21,102,803            0
95.49% (447,087,069B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->95.35% (446,440,727B) 0x2EFB99: tal_resize_ (tal.c:755)
| ->94.23% (441,180,860B) 0x2EBCD1: grab_fd (grab_file.c:45)
| | ->94.23% (441,180,860B) 0x2EBD54: grab_file (grab_file.c:63)
| |   ->94.23% (441,180,860B) 0x1A5CF7: file_checksum (plugin.c:315)
| |     ->94.23% (441,180,860B) 0x1A5EF1: plugin_register (plugin.c:355)
| |       ->94.23% (441,180,860B) 0x1AC62E: plugins_set_builtin_plugins_dir (plugin.c:2532)
| |         ->94.23% (441,180,860B) 0x16D614: find_subdaemons_and_plugins (lightningd.c:569)
| |           ->94.23% (441,180,860B) 0x16E9A1: main (lightningd.c:1226)
| |
| ->01.11% (5,219,417B) 0x2EBC32: grab_fd (grab_file.c:38)
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-24 13:59:58 +10:30
Rusty Russell
04b21c34d3 lightningd: fix overzealous memleak report.
Found by CI, not a real leak.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-24 13:59:58 +10:30
Christian Decker
66deb4dee5 opening: Do not forget a zeroconf channel we own funds in
Changelog-Fixed opening: We no longer forget zeroconf channels in which we own funds due to a confirmation timeout
2025-03-19 17:32:26 +01:00
Rusty Russell
71eb04064c common: implement op_return test.
Since we included the spec for it, this is a good time to implement
it.

I also asked chatgpt to write some unit tests.  I had to mangle them a
bit, but it probably saved me a few minutes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-18 14:30:58 +10:30
Rusty Russell
58e14284e2 BOLTs: Add typo fixes and clarifications from "More clarifications around channel_announcement handling (#1220)"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-18 14:30:58 +10:30
Rusty Russell
67c91a7e5c BOLTs: Update to version with peer storage merged.
Unfortunately a spec typo means the data fields are missing (PR pending),
so we still patch those in.

The message "your_peer_storage" got renamed to "peer_storage_retrieval",
and the option "want_peer_backup_storage" was removed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: `experimental-peer-storage` now only advertizes feature 43, not 41.
2025-03-18 14:30:58 +10:30
Rusty Russell
73fc9b0c2a plugins: all plugins must now support non-numeric JSON RPC id fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: plugins which didn't accept string JSON RPC fields (deprecated v23.08, disabled by default in v24.11).
2025-03-12 09:26:08 +10:30
Rusty Russell
d69499b558 lightningd: no longer allow plugin flag options with non-false default values.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: default settings for flag options in plugins which aren't "false".
2025-03-12 09:26:08 +10:30
Rusty Russell
f95b542c1e plugins: no longer accept 0/1 for boolean options.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: allowing 0/1 instead of false/true for plugin options (deprecated v23.08, disabled by default in v24.11).
2025-03-12 09:26:08 +10:30
Rusty Russell
c1c93a3212 lightningd: remove announce-addr-dns flag.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: Config: `announce-addr-dns` (deprecated v23.08, disabled in v24.11).
2025-03-12 09:26:08 +10:30
Rusty Russell
7fbc814796 lightningd: remove --bind-addr and --addr munging on onions and local sockets.
Changelog-Removed: --bind-addr and --addr on onion addresses and local sockets (deprecated v23.08, disabled by default in v24.11).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-12 09:26:08 +10:30
Rusty Russell
f2852846d2 lightningd: remove accept-htlc-tlv-types.
Changelog-Removed: accept-htlc-tlv-types (deprecated v23.08, disabled by default in v24.11).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-12 09:26:08 +10:30
Rusty Russell
4f17672001 lightningd: disable old notification fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: connection/disconnection/block_added notification raw fields (deprecated v23.08, disabled by default in v24.11).
2025-03-12 09:26:08 +10:30
Rusty Russell
cce0212819 lightningd: remove old listconfigs output.
We haven't printed this since v24.08.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: listconfigs raw listing (deprecated v23.08, disabled by default in v24.11).
2025-03-12 09:26:08 +10:30
Rusty Russell
97d823ba1d lightningd: fix use of deprecation macro.
_in_ versions complain if used, _out_ don't (since we don't know if they are
going to use it).  This was the wrong choice, and thus causes a BROKEN log
message when we update CLN_NEXT_VERSION.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-12 09:26:08 +10:30
Rusty Russell
1605c13c1a lightningd: fix crash in onchaind replay.
If a tx has already spent one tx we're watching, and it spends another,
we try to add it to the hash table twice, which isn't allowed:

```
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: ../sysdeps/unix/sysv/linux/raise.c:51 (__GI_raise) 0x7fab2e363d51
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: ./stdlib/abort.c:79 (__GI_abort) 0x7fab2e34d536
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: ./assert/assert.c:92 (__assert_fail_base) 0x7fab2e34d40e
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: ./assert/assert.c:101 (__GI___assert_fail) 0x7fab2e35c6d1
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: lightningd/onchain_control.c:48 (replay_tx_hash_add) 0x556928d4e114
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: lightningd/onchain_control.c:365 (replay_watch_tx) 0x556928d4e114
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: lightningd/onchain_control.c:419 (replay_block) 0x556928d4e835
2025-02-28T23:00:32.155Z **BROKEN** lightningd: backtrace: lightningd/bitcoind.c:506 (getrawblockbyheight_callback) 0x556928d1c791
```

Fixes: #8131
Reported-by: Vincenzo Palazzo
Changelog-None: introduced this release, when we banned htable dups.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-02 16:06:34 -06:00
Rusty Russell
5e4c1b7839 lightningd: redo closing negotiation even if we consider channel closed.
This corner case started triggering on my machine with latest Bitcoind.

This test sabotages the closing negotiation, and as a result l1
doesn't see l2's CLOSING_SIGNED.  l2 is happy, however, and it is in
CLOSINGD_COMPLETE.  When l1 reconnects, it gets an error, and this causes
it to drop the unilateral tx to chain.

This unilateral tx from l1 replaces or races the mutual close tx from
l2, causing a unilateral close, which breaks our test.

Though this is a corner case, it's much friendlier to allow the
closing negotiation again until we actually see the close onchain.
This fixes the tests here, too.

```
    def test_closing_negotiation_reconnect(node_factory, bitcoind):
        disconnects = ['-WIRE_CLOSING_SIGNED',
                       '+WIRE_CLOSING_SIGNED']
        l1, l2 = node_factory.line_graph(2, opts=[{'disconnect': disconnects,
                                                   'may_reconnect': True},
                                                  {'may_reconnect': True}])
        l1.pay(l2, 200000000)
    
        assert bitcoind.rpc.getmempoolinfo()['size'] == 0
    
        l1.rpc.close(l2.info['id'])
        l1.daemon.wait_for_log(r'State changed from CHANNELD_NORMAL to CHANNELD_SHUTTING_DOWN')
        l2.daemon.wait_for_log(r'State changed from CHANNELD_NORMAL to CHANNELD_SHUTTING_DOWN')
    
        # Now verify that the closing tx is in the mempool.
        bitcoind.generate_block(6, wait_for_mempool=1)
        sync_blockheight(bitcoind, [l1, l2])
        for n in [l1, l2]:
            # Ensure we actually got a mutual close.
>           n.daemon.wait_for_log(r'Resolved FUNDING_TRANSACTION/FUNDING_OUTPUT by MUTUAL_CLOSE')

tests/test_closing.py:275: 
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Protocol: We now renegotiate an interrupted close, even if we don't need it, instead of sending an error.
2025-02-26 10:22:03 -06:00
Rusty Russell
a4aa77761c lightningd: create helper routine to make socketpair for a channel.
This is a bit too much boilerplate for these, which mainly do the same
thing.

We add annotaitons to new_peer_fd so the compiler knows that it cannot
return NULL, otherwise with -O3 we get:

```
lightningd/peer_control.c: In function ‘peer_connected_hook_final’:
lightningd/peer_control.c:1388:28: error: ‘error’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1388 |                       take(towire_connectd_peer_send_msg(NULL, &channel->peer->id,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lightningd/peer_control.c:1313:19: note: ‘error’ was declared here
 1313 |         const u8 *error;
      |                   ^~~~~
lightningd/peer_control.c: In function ‘peer_spoke’:
lightningd/peer_control.c:1999:28: error: ‘error’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1999 |                       take(towire_connectd_peer_send_msg(NULL, &peer->id,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:311: lightningd/peer_control.o] Error 1
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-26 10:22:03 -06:00
Rusty Russell
79b28eb8c2 onchaind: tell lightningd correct nSequence value for local leases.
If the nSequence in the tx it produces is not at least the value we
test in the script, the tx will always fail:

```
error code: -26\nerror message:\nmandatory-script-verify-flag-failed (Locktime requirement not satisfied)
```

If we have a lease, the nSequence is max(lease-time-remaining,
to-self-delay), so have onchaind tell lightningd the correct nSequence.

Fixes: https://github.com/ElementsProject/lightning/issues/7460
Reported-by: https://github.com/pabpas
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: Correctly collect our own (delayed) funds if we have a unilateral close when we are still offering a lease.
2025-02-25 10:10:14 +10:30
Rusty Russell
4fdbd8ba98 lightningd: catch edits of config files *before* we're committed.
Another report, that we crash if it's edited.  We should check that too!

Reported-by: daywalker90
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-24 19:38:37 +10:30
Rusty Russell
5e79cd4608 lightningd: check for writability before allowing setconfig.
If we actually can't write it, we crash (to avoid an inconsistent
state), so sanity check FIRST.

Fixes: https://github.com/ElementsProject/lightning/issues/7964
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-24 19:38:37 +10:30
Rusty Russell
989cf17982 setconfig: put vars in separate "config.setconfig" file.
This is neater than appending to some random file: we only do that once
if there's no "include" line to include a ".setconfig" file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-24 19:38:37 +10:30
Rusty Russell
f4872f96db common: return location of a ".setconfig" file when we load config.
This is where we will put all the dynamic settings.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-24 19:38:37 +10:30
Rusty Russell
da2fb198c4 setconfig: make source for setconfig "setconfig transient".
Previously it would be the value of the previous config setting.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-24 19:38:37 +10:30
Rusty Russell
5a80223f3e setconfig: add transient option.
Changelog-Added: JSON-RPC: `setconfig` now has a `transient` flag which means it won't rewrite your config file.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-24 19:38:37 +10:30
Rusty Russell
98f15aecf4 lightningd: remove redundant command_check_only()
setconfig_success does this itself at the start, so we don't need it here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-24 19:38:37 +10:30
Aditya Sharma
ab3ad617ce peer_control: Update shainchain and basepoints
Add the latest shachain when we update the emergency.recover using staticbackup RPC.
2025-02-22 11:51:54 -06:00
Aditya Sharma
cf2bd9f616 lightningd: Modify stub_chan() to accomodate new fields
These fields enhance 'stub_chan' to make channels which are capable to
create penalty transaction in case the peer broadcasts an old revoked state.

Key Changes:
 - Added new params to stub_chan() to accomodate shachain, basepoints, opener, and remote_to_self_delay
 - Check if any field is NULL inside scb_chan->tlvs and assign them appropriately
2025-02-22 11:51:54 -06:00
Aditya Sharma
fe02d2f1c5 scb_wire: Define new subtype 'modern_scb_chan' with 'scb_tlvs'
We define a new subtype 'modern_scb_chan' and a new tlvtype 'scb_tlvs' which includes
all the relevant information to create a penalty transaction when the peer tries to cheat.

Key Changes:
 - Rename the old format to 'legacy_scb_chan' and define a new type 'modern_scb_chan'
 - Include TLVs to 'modern_scb_chan'
 - Create a new msgtype 'static_chan_backup_with_tlvs'
 - Modify 'struct channel' to include 'struct modern_scb_chan'
 - Add these two types to 'varsize_types' in generate.py
2025-02-22 11:51:54 -06:00
Rusty Russell
afb54ff8e8 lightningd: actually deprecate the listpeerchannels field.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-21 17:03:36 -06:00
Lagrang3
fe4d5036c2 add max_htlc_value_in_flight_msat to listpeerchan
Changelog-Added: JSON-RPC: `listpeerchannels` new output fields `their_max_total_htlc_out_msat` and `our_max_total_htlc_out_msat` as the value of `max_htlc_value_in_flight` (as of BOLT02) set by the local and remote nodes on channel creation.

Changelog-Deprecated: JSON-RPC: `listpeerchannels` value `max_total_htlc_in_msat`: use `our_max_total_htlc_out_msat` instead to follow spec naming convention.
2025-02-21 17:03:36 -06:00
Rusty Russell
d15f5a9b3b lightningd: don't even transiently try to connect to private nodes if --dev-no-reconnect-private.
Christian reported that this flag doesn't work on restart.

Indeed, it made us attempt *transient* rather than *persistent*
connections, but we still told connectd to connect.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: connectd: `dev-no-reconnect-private` is respected on restart.
2025-02-21 11:24:35 +10:30
Rusty Russell
ca0c9e63ad lightningd: insert "raw" (unescaped) help messages from commands.
So if they want a \n in usage, they can have it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-20 14:37:28 +10:30
Rusty Russell
2ffe07b0df lightningd: make i-promise-to-fix-broken-api-user an early option.
Otherwise it doesn't work to fix up other options!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-13 21:15:45 -06:00
gudnuf
4a280148f1 single plugin_notification_serialize function 2025-02-12 12:54:10 +10:30
gudnuf
61482e5f45 new notifications: plugin_stopped and plugin_started
[Added version tag into documentation, to show it was added in 25.02 --RR]
Changelog-Added: Plugins: new nofitications `plugin_stopped` and `plugin_started`
2025-02-12 12:54:10 +10:30
Rusty Russell
c3362b057c BOLT12: remove -offers from bolt12 quotes, update them.
Typo fixes and wording changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-11 20:19:01 -06:00
Rusty Russell
77eef3b62e lightningd: update bolts to clarify channel_update timing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-11 20:19:01 -06:00
Rusty Russell
4e7ba96729 lightningd: don't kill onchaind if we are forcing a disconnect.
We thought it was a good idea to terminate channel subds, but we included onchaind as well!

```
2025-01-29T21:31:46.053Z UNUSUAL 03…00-channeld-chan#255683: Adding HTLC 1737 too slow: killing connection
2025-01-29T21:31:46.053Z INFO    03…00-chan#255683: Peer transient failure in CHANNELD_NORMAL: Adding HTLC timed out: killed connection
2025-01-29T21:31:46.053Z DEBUG   03…00-channeld-chan#255683: Status closed, but not exited. Killing
2025-01-29T21:31:46.054Z DEBUG   03…00-chan#255683: Failing HTLC 1738 due to peer death
2025-01-29T21:31:46.058Z DEBUG   03…00-chan#255683: Failing HTLC 1737 due to peer death
2025-01-29T21:31:46.058Z DEBUG   03…00-chan#255673: Forcing disconnect due to One channel had an error
2025-01-29T21:31:46.059Z DEBUG   03…00-onchaind-chan#255673: Status closed, but not exited. Killing
2025-01-29T21:31:46.093Z DEBUG   03…00-connectd: disconnect_peer
2025-01-29T21:31:46.093Z DEBUG   03…00-lightningd: peer_disconnect_done
```

Reported-by: @whitslack
Fixes: https://github.com/ElementsProject/lightning/issues/8055
Changelog-Fixed: onchaind: don't die if we fail an unrelated channel with the same peer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-10 19:19:12 -06:00
Rusty Russell
ee3133f198 lightningd: increase startup time for plugins to 120 seconds.
Raspberry Pi, with bitcoind running and full gossip topology may actually hit
this, and we have a report in practice.

Note that the comment is wrong, so fix that too.

Fixes: https://github.com/ElementsProject/lightning/issues/7724
Reported-by: m-schmoock
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-10 16:06:36 -06:00
Rusty Russell
b78b3232e3 lightningd: implement unblacklist.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `blacklistrune` now has an option to un-blacklist (`relist`).
2025-02-05 16:43:09 -06:00
Rusty Russell
d72f045db9 lightningd: represent runes blacklist as simple bitmap.
Sure, we have to convert to and from the db set-of-pairs, but that's far simpler
than dealing with the current structure now we want to add code to *remove* from
the blacklist.

Changelog-Changed: JSON-RPC: `blacklistrune` no longer supports of runes over id 100,000,000.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-02-05 16:43:09 -06:00
Rusty Russell
4e887c7c67 lightningd: add option to crash itself after some time.
We have CI runs which timeout (after 2 hours).  It's not clear why,
but we can at least eliminate CLN lockups as the answer.

Since pytest disabled the --timeout option on test shutdown, we could be
seeing an issue on stopping taking a long time?

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-01-27 11:07:04 +10:30
Rusty Russell
b6c1ffa359 ccan/htable: update to explicit DUPS/NODUPS types.
The updated API requires typed htables to explicitly state whether they
allow duplicates: for most cases we don't, but we've had issues in the
past.

This is a big patch, but mainly mechanical.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-01-21 09:18:25 +10:30
Rusty Russell
d6217e2835 wallet: do proper memleak scan of outpoint htables, not notleak().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-01-21 09:18:25 +10:30