Commit Graph

17471 Commits

Author SHA1 Message Date
Sangbida Chaudhuri
6a9bdb8087 pytest: determine scid direction dynamically
Since we have changed our hsm_secret seed the node ids have all change hence the asseertions on the scids break. This changes it so that the direction is determined when the test executes.
2026-01-27 09:32:49 +10:30
Rusty Russell
4d8f923a9a logging: switch to a simple ringbuffer.
We keep a history of logs internally, so we can drop them to disk on a
crash.  This "black box recorder" was some of the first code I wrote
for CLN, but I can't remember the last time we use a crash log to
diagnose a problem.

We attempt to prune it to keep it under 10MB, but the complexity
and cost is rarely worth it: simplify it to use a ringbuffer.

Changelog-Changed: lightningd: logging is now more efficient internally (no more pruning, simple ringbuffer).

```
     139993 DEBUG   lightningd: fixup_scan: block 786151 with 1203 txs
===>  55388 DEBUG   plugin-bcli: Log pruned 1001 entries (mem 10508118 -> 10298662)
      33000 DEBUG   gossipd: Unreasonable timestamp in 0102000a38ec41f9137a5a560dac6effbde059c12cb727344821cbdd4ef46964a4791a0f67cd997499a6062fc8b4284bf1b47a91541fd0e65129505f02e4d08542b16fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000d9d56000ba40001690fe262010100900000000000000001000003e8000001f30000000000989680
      23515 DEBUG   hsmd: Client: Received message 14 from client
      22269 DEBUG   024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605-hsmd: Got WIRE_HSMD_ECDH_REQ
      14409 DEBUG   gossipd: Enqueueing update for announce 0102002f7e4b4deb19947c67292e70cb22f7fac837fa9ee6269393f3c513d0431d52672e7387625856c19299cfd584e1a3f39e0f98df13c99090df9f4d5cca8446776fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000e216b0008050001692e1c390101009000000000000003e800000000000013880000004526945a00
      12534 DEBUG   gossipd: Previously-rejected announce for 514127x248x1
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Got it!
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: ... , awaiting 1120
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Sending master 1020
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-27 09:31:02 +10:30
Rusty Russell
6749c65641 getlog: fix schema.
getlog() only gets recent logs, not all of them (since it prunes, and soon will be a ringbuffer).

And "data" is actually an optional field, not required.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-27 09:31:02 +10:30
Rusty Russell
16e9116066 lightningd: move log_prefix and log_entry struct definitions into log.c.
They're only exposed because of the notifications, but they are better
off with explicit parameters anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-27 09:31:02 +10:30
Rusty Russell
e383e14cb3 connectd: don't be That Node when someone is gossipping crap.
As seen in my logs, we complain about nodes a *lot* (Hi old CLN!).

```
===>1589311 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-connectd: peer_out WIRE_WARNING
     139993 DEBUG   lightningd: fixup_scan: block 786151 with 1203 txs
      55388 DEBUG   plugin-bcli: Log pruned 1001 entries (mem 10508118 -> 10298662)
      33000 DEBUG   gossipd: Unreasonable timestamp in 0102000a38ec41f9137a5a560dac6effbde059c12cb727344821cbdd4ef46964a4791a0f67cd997499a6062fc8b4284bf1b47a91541fd0e65129505f02e4d08542b16fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000d9d56000ba40001690fe262010100900000000000000001000003e8000001f30000000000989680
      23515 DEBUG   hsmd: Client: Received message 14 from client
      22269 DEBUG   024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605-hsmd: Got WIRE_HSMD_ECDH_REQ
      14409 DEBUG   gossipd: Enqueueing update for announce 0102002f7e4b4deb19947c67292e70cb22f7fac837fa9ee6269393f3c513d0431d52672e7387625856c19299cfd584e1a3f39e0f98df13c99090df9f4d5cca8446776fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000e216b0008050001692e1c390101009000000000000003e800000000000013880000004526945a00
      12534 DEBUG   gossipd: Previously-rejected announce for 514127x248x1
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Got it!
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: ... , awaiting 1120
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Sending master 1020
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-27 09:31:02 +10:30
Rusty Russell
cef86d1e25 gossmap: don't log every time we don't like a cupdate.
This happens for about 300 channels, from every process that loads the gossmap.

It's not very useful to flood the logs, so just log a summary.

To be fair, on my node, this is only the 11th most common message, so we will
revisit the others too:

```
    1589311 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-connectd: peer_out WIRE_WARNING
     139993 DEBUG   lightningd: fixup_scan: block 786151 with 1203 txs
      55388 DEBUG   plugin-bcli: Log pruned 1001 entries (mem 10508118 -> 10298662)
      33000 DEBUG   gossipd: Unreasonable timestamp in 0102000a38ec41f9137a5a560dac6effbde059c12cb727344821cbdd4ef46964a4791a0f67cd997499a6062fc8b4284bf1b47a91541fd0e65129505f02e4d08542b16fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000d9d56000ba40001690fe262010100900000000000000001000003e8000001f30000000000989680
      23515 DEBUG   hsmd: Client: Received message 14 from client
      22269 DEBUG   024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605-hsmd: Got WIRE_HSMD_ECDH_REQ
      14409 DEBUG   gossipd: Enqueueing update for announce 0102002f7e4b4deb19947c67292e70cb22f7fac837fa9ee6269393f3c513d0431d52672e7387625856c19299cfd584e1a3f39e0f98df13c99090df9f4d5cca8446776fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000e216b0008050001692e1c390101009000000000000003e800000000000013880000004526945a00
      12534 DEBUG   gossipd: Previously-rejected announce for 514127x248x1
===>  12092 DEBUG   connectd: Bad cupdate for 641641x1164x1/1, ignoring (delta=80, fee=1073742199/58)
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Got it!
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: ... , awaiting 1120
      10761 DEBUG   02e01367e1d7818a7e9a0e8a52badd5c32615e07568dbe0497b6a47f9bef89d6af-channeld-chan#70770: Sending master 1020
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-27 09:31:02 +10:30
Se7enZ
eba330566d devtools: Set pre-commit default versions for Python and NodeJS.
Default to Python 3 and NodeJS to use that which is on the system,
avoiding conflicts with `nodeenv`.
2026-01-24 09:40:49 +10:00
Se7enZ
2fa0feecc5 devtools: Replace Ruff with Flake8 in pre-commit. 2026-01-24 09:40:49 +10:00
Se7enZ
623300d6a3 devtools: Add commitlint to pre-commit. 2026-01-24 09:40:49 +10:00
Se7enZ
5ca181ec89 devtools: Add custom include-order-fixer to pre-commit.
Also fixes some exising file spacing issues. Preserves whitespace and
comments.

Assisted by Cursor Auto.
2026-01-24 09:40:49 +10:00
Se7enZ
70fe02513c build: Replace PLUGIN_RENEPAY_HDRS json.c with json.h in Makefile. 2026-01-24 09:40:49 +10:00
Se7enZ
ee94ba3df9 devtools: Add clang-format to pre-commit. 2026-01-24 09:40:49 +10:00
Se7enZ
2bc67c37c4 doc: Add pre-commit section to Contributor Workflow documentation. 2026-01-24 09:40:49 +10:00
Se7enZ
854dec008e devtools: Add pre-commit as a dev Python package. 2026-01-24 09:40:49 +10:00
Se7enZ
27482957a9 devtools: Add fix-style-errors script by @sangbida.
A helper tool to fix code style errors using `ruff` and `clang-format`
and correct spelling.
2026-01-24 09:40:49 +10:00
Se7enZ
e91625a68b devtools: Add EOF fixer and trailing whitespace fix to pre-commit. 2026-01-24 09:40:49 +10:00
Se7enZ
a22ba9ba52 devtools: Add doc JSON schema checks and formatting to pre-commit. 2026-01-24 09:40:49 +10:00
Se7enZ
969bd22d2f devtools: Add codespell to pre-commit.
Includes default config file and an initial word list to ignore.
2026-01-24 09:40:49 +10:00
Se7enZ
6e50148bcd devtools: Add discouraged function check to pre-commit.
Reimplements `make check-discouraged-functions` for Python regex.
2026-01-24 09:40:49 +10:00
Se7enZ
a04fdb74d9 devtools: Add amount access check to pre-commit.
Reimplements `make check-amount-access` for Python regex.
2026-01-24 09:40:49 +10:00
Se7enZ
98c149c797 devtools: Add shellcheck to pre-commit. 2026-01-24 09:40:49 +10:00
Rusty Russell
d5f66ceabc plugins: don't try to fetch max-locktime-blocks.
It was removed in v25.09, so this code is useless.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
95d876011a lightningd: remove support for long-deprecated old-style feerate responses.
This was supposed to be removed in v24.05.  Finally remove it now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: lightningd: `estimatefeesv1` support for older bcli plugins (deprecated v23.05, disabled by default v24.05).
2026-01-20 19:32:42 +10:30
Rusty Russell
f8ef6e143b lightningd: removing comment insisting plugin hooks are an array of objects, not names.
This was changed in v0.9.2 (November 2020), with a comment saying to remove.

But it turns out that the rust plugin support still uses the old
method (found this by removing it and watching everything fail!).  So
simply undeprecate and document.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
983146791a lightningd: remove tx and txid fields from close response.
Changelog-Removed: JSON-RPC: `close` `tx` and `txid` field (use `txs` and `txids`), deprecated v24.11.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
592f8586f4 lightningd: remove decodepay.
Changelog-Removed: JSON-RPC: `decodepay` (use `decode`), deprecated v24.11.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
9881e04636 lightningd: remove the "listpeers.features.option_anchors_zero_fee_htlc_tx" option.
Everyone should be using the new name.

Changelog-Removed: JSON-RPC: `listpeers` `features` array string "option_anchors_zero_fee_htlc_tx": use "option_anchors" (spec renamed it). Deprecated in 24.08.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
af1c9640b5 hsmd: remove unused "sign_local_htlc_tx" function which onchaind used to use.
I tried removing sign_penalty_to_us, but that comment is wrong: channeld
uses that for the watchtower, so it stays (with updated comment).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
bcce29eeb0 connectd: remove unused flag to connect_init.
We haven't announced websocket addresses for some time!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
ee0175b85f Makefile: update next and prev versions now we've released.
This means:
1. downgrade changes (we no longer fail due to node biases).
2. various deprecations no longer are

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
3af6fd2f30 doc: fix end deprecation date of max_htlc_value_in_flight_msat.
The code had this as 26.03, but the documentation said 26.06.  The
usual deprecation period is a year, so I'm changing the documentation.
Unfortunately the documentation (fe4d5036c2) was updated separately
from the code (afb54ff8e8), so this wasn't obvious at the time!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
9081499b0e libplugin: fix 'i-promise-to-fix-broken-api-user' parsing.
This is important for the first xpay deprecation end-of-life!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
Rusty Russell
c8525a1322 git: correctly mark contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py for binary diffs.
The giant text lines make emacs ... run... slowly.  Finally got around to fixing it
to see that it had already been done, just not updated!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-20 19:32:42 +10:30
ShahanaFarooqui
9655f53194 script: More error checks and logging 2026-01-20 15:22:31 +10:30
ShahanaFarooqui
58a620aa88 script: API v2 accepts position param rather than order 2026-01-20 15:22:31 +10:30
ShahanaFarooqui
15081de19f script: Change category slug for better Admin panel management 2026-01-20 15:22:31 +10:30
ShahanaFarooqui
79ffb3a7ab doc: Update json and markdowns to make them .mdx compatible
readme v2 API expects files to be .mdx compatible.
2026-01-20 15:22:31 +10:30
ShahanaFarooqui
6a1f467d3f doc: Add signmessagewithkey to generate documentation
And sorted list with file name.
2026-01-20 15:22:31 +10:30
Christian Decker
eae521b15d chore: Ensure the logging library does not get upset when output capture is disabled.
Changelog-Fixed: Testing infrastructure no longer fails when logging output capture is disabled.
2026-01-20 15:05:07 +10:30
Christian Decker
49049deb82 testing: Add TEST_LOG_IGNORE_ERRORS envvar to suppress logging errors 2026-01-20 15:05:07 +10:30
daywalker90
d03cf820a8 clnrest: add clnrest-register-path method for dynamic paths
Changelog-Added: clnrest: add clnrest-register-path rpc method to register dynamic paths
2026-01-19 12:55:57 +10:30
daywalker90
8bc2e76f44 msggen: add string_map type 2026-01-19 12:55:57 +10:30
ShahanaFarooqui
ec7d247f38 docker: Added fixed SOURCE_DATE_EPOCH flag for reproducible Fedora build
- Using environment variable `SOURCE_DATE_EPOCH` with fixed value will enforce a consistent timestamp for Fedora build.
. Similar to Ubuntu fix in commit 490fb0fc3b
- Locked cargo version
- Add `no-cache` to Fedora build

Changelog-Fixed: Core lightning builds for Fedora on all systems are deterministic.
2026-01-16 12:34:03 -08:00
ShahanaFarooqui
12ccfb5c65 script: Add Fedora as target for SHASUMS verification 2026-01-16 12:34:03 -08:00
Alex Myers
9e490942af contrib: ignore cache when rebuilding docker builder images
This caused issues when dependencies were updated do to cached
images continuing to be used.

Changelog-None
2026-01-15 18:31:11 -08:00
ShahanaFarooqui
ae0e10875c doc: Update installation instruction on Fedora 2026-01-15 17:10:27 -08:00
ShahanaFarooqui
3f7565a3d2 docker: Update Fedora base image to 40
- Upgraded Fedora base image from 35 to 40. The existing Cargo failures were caused by the outdated Rust toolchain in Fedora 35. Cargo lockfile format v4 was introduced in Cargo 1.84 (December 2024), while Fedora 35 provides a Rust/Cargo version from roughly 2021–2022. As a result, the system Cargo could not parse modern Cargo.lock files, making it incompatible with current Rust projects.

- Added missing build dependencies to the Dockerfile, most notably the protobuf compiler (protoc).

Changelog-None: Upgraded Fedora version to 40 for reproducible build.
2026-01-15 17:10:27 -08:00
Rusty Russell
29465f5240 wallet: use correct derivation for elements when using mnemonic hsm_secret.
Even though we don't do taproot addresses on elements yet, use the
same scheme for simplicity and for future when we *do* do taproot.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-01-14 17:18:56 +10:30
Sangbida Chaudhuri
0269d0c0c9 jsonrpc: fix recover command for BIP86 wallets
The recover command checks if a node has already issued bitcoin
addresses before allowing recovery. This check only looked at
bip32_max_index, but with BIP86 wallets, newaddr() increments
bip86_max_index instead.

Also, the recover test asserted on hex but now it's asserting on codex32 instead. We should probably go in and fix the end point. @rustyrussell what do you think?
2026-01-14 17:18:56 +10:30
Sangbida Chaudhuri
e19fd5d62c wallet: change dev_listaddrs to also list bip86 addresses
listaddrs is dev only and used in tests so it's okay if we change the API here, the usage is by positional arguments in tests so we're okay. Also changing est_option_upfront_shutdown_script to handle both old hsmsecret and the newer mnemonic one.
2026-01-14 17:18:56 +10:30