Commit graph

488 commits

Author SHA1 Message Date
Sangbida Chaudhuri
58f0c16a57 devtools: add --markdown output to credit for release notes
Generate a comprehensive contributor list ordered by commits, with a
separate section for first-time contributors, so release notes no longer
need manually maintained lists.

Co-Authored-By: Cursor <cursoragent@cursor.com>
2026-06-30 14:53:00 +10:00
Vincenzo Palazzo
94bebdef0b common: add bolt12 payer proof support (bolt12-cli)
[Adapted for my decode routines --RR]
2026-05-11 11:13:55 +09:30
Rusty Russell
1189175cbc common/bolt12: use a const char * for fail reason.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-05-11 11:13:55 +09:30
Rusty Russell
bf55e580d6 decode / bolt12-cli: add missing invreq_recurrence_cancel field.
We missed this.  It's experimental, so no changelog needed.

Spotted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-05-11 11:13:55 +09:30
Rusty Russell
48c6697d73 devtools/bolt12-cli: add missing offer_metadata field.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-05-11 11:13:55 +09:30
Rusty Russell
0c63d015d0 BOLT12: don't allow zero-amount offers.
And enhance some of our quotes to use `...` at the start to link them.
As they were, we didn't notice when a new requirement appeared in the
middle.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-04-30 20:09:31 +09:30
Rusty Russell
3d9bdab1e7 common: correctly refuse to accept wireaddr with port == 0.
BOLT 7 says this, but we don't do it.  (Actually, it only says that for certain types,
but I've fixed that in https://github.com/lightning/bolts/pull/1331).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-04-30 12:17:43 +09:30
Rusty Russell
63aa76501a check_quotes.py: add --coverage tracking; add devtools/bolt-coverage.py.
check_quotes.py gains --coverage=FILE: on each successful match, atomically
appends one line '{bolt} {section_idx} {start} {end}' to FILE using a single
os.write() call so parallel make invocations don't interleave records.

find_quote() and find_quote_immediate() are updated to return match start
positions (needed to record the covered range, not just the end).

bolt-coverage.py reads the coverage file and reports BOLT text not covered
by any source comment.  By default it restricts output to Requirements
sections; --all-sections shows every section.  --bolt N restricts to
a single BOLT number.

Exit status is 0 if everything in the selected sections is covered, 1 if
anything is uncovered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-30 12:17:43 +09:30
Rusty Russell
021a5777e3 check-source-bolt: replace C check-bolt tool with Python check_quotes.py, check Rust and Python too
Extend check-source-bolt to also check Python and Rust source files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-04-30 12:17:43 +09:30
Rusty Russell
07d1db0002 BOLT quotes: split cross-section quotes; prepare for new ... semantics.
The new check_quotes.py tool will treat `...` at the start of a quote as
"immediately follows previous quote in BOLT text". To prepare for that,
we change existing quotes which used leading `...` to mean "skip some
text": split them into two consecutive BOLT comments (the second starting
with `...` to use the existing wildcard match), and add explicit `*...`
markers between consecutive BOLT test vector sections which cross `# From`
headers.

Also remove leading `...` from nonce quotes in cryptomsg.c/handshake.c
where the actual BOLT text starts a fresh sentence (no prior quote in file).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
sCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-30 12:17:43 +09:30
Rusty Russell
12c3e2eab8 devtools/check_quotes.py: add -k option, make ... more nuanced.
Splits BOLT files into per-section chunks so wildcards can't inadvertently
cross section headers, supports `...`-at-start semantics, and adds make-style `-k`

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-04-30 12:17:43 +09:30
Rusty Russell
63c433c2e2 devtools: import check_quotes.py from lnprototest.
The Python tool (copied from lnprototest) handles multiple comment styles.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-04-30 12:17:43 +09:30
Rusty Russell
f4b85859a9 decode: print htlc_minimum_msat / htlc_maximum_msat in blinded paths.
Weird we didn't print this before!

Reported-by: https://github.com/Lagrang3
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-04-02 10:36:10 +10:30
Rusty Russell
9b85a247aa common: add tal_free_if_taken() helper for common case.
Uses found and changed by Claude.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-03-29 14:35:54 +10:30
Sangbida Chaudhuri
93c9adb415 v26.04rc1
Changelog-None
2026-03-23 14:48:59 +10:00
Rusty Russell
b1031e5637 Makefile: support overriding of CC and CARGO for catching unintended builds.
For CI we want to make sure we don't rebuild.  CC=false doesn't work because
we reply on the output of "$CC -dumpmachine" for the external build directory.

So we would use:

	make CC=devtools/cc-nobuild CARGO=false

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-02-24 11:54:04 +10:30
Sangbida Chaudhuri
c22538ecaf misc: fix uninitialised errors for macOS
MacOS SDK is quite strict so treats these uninitialised variable warnings as errors.
2026-02-23 19:08:24 +10:30
wqxoxo
f318c13bf5 db: add STRICT tables with migration for old databases
Enables STRICT tables in developer mode, but old databases (~2019) may
have BLOB values in TEXT columns. Migration converts BLOB faildetail
to TEXT with UTF-8 validation, NULLs invalid data.

STRICT is only applied to fresh databases; existing databases being
upgraded skip STRICT to avoid type affinity issues with legacy data.

Also adds security pragmas in developer mode: trusted_schema=OFF,
cell_size_check=ON.

Fixes #5390.

Changelog-Added: Database: STRICT tables and security pragmas in developer mode
Changelog-Fixed: Database migration for old BLOB-typed faildetail values
2026-02-23 15:55:55 +10:30
Rusty Russell
ca2d389920 devtools/gossipwith: don't count "padding" pings towards max-messages count.
We are about to use them to make our packet size constant, and this
will upset the tests.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-02-18 14:13:25 +10:30
Rusty Russell
facf24b6ee devtools/gossmap-compress: create latest gossip_store version
This saves gossipd from converting it:

```
lightningd-1 2026-02-02T00:50:49.505Z DEBUG   gossipd: Time to convert version 14 store: 890 msec
```

Reducing node startup time from 1.4 seconds to 0.5 seconds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-02-16 17:23:33 +10:30
Rusty Russell
e8fd235d4e common: move gossip_store_wire.csv into common/ from gossipd/
It's used by common/gossip_store.c, which is used by many things other than
gossipd.  This file belongs in common.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-02-16 17:23:33 +10:30
Rusty Russell
b1055aa0ac gossip_store: add UUID entry at front of the store.
We also put this in the store_ended message, too: so you can
tell if the equivalent_offset there really refers to this new
entry (or if two or more rewrites have happened).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-02-16 17:23:33 +10:30
Rusty Russell
120c9d8ce4 devtools/gossmap-compress: generate better scids.
Our poor scid generation clashes badly with simplified hashing (the
next patch) leading to l1's startup time when using a generated map
moving from 4 seconds to 14 seconds.  Under CI it actually timed out
several tests.

Fixing our fake scids to be more "random" reduces it to 1.5 seconds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-02-16 17:23:33 +10:30
Rusty Russell
e5e5998cd8 devtools: enhance dump-gossipstore to show some details of messages.
Not a complete decode, just the highlights (what channel was announced
or updated, what node was announced).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2026-02-16 17:23:33 +10:30
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
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
Christian Decker
686ce98906 git: Remove generated binary 2025-12-08 16:37:02 +01:00
Christian Decker
4b9cffe183 Add comprehensive coverage infrastructure with clang source-based coverage
This commit introduces a modern coverage infrastructure for Core Lightning:

- Migrate from ad-hoc coverage script to integrated Makefile targets
- Add LLVM source-based coverage support with per-test profraw organization
- Integrate coverage collection into pytest framework via TailableProc
- Add GitHub Actions workflow for nightly coverage reports
- Add Taskfile.yml for convenient task automation
- Add codecov.yml for Codecov integration
- Add comprehensive coverage documentation in COVERAGE.md
- Update contributor workflow docs with new coverage script path
- Add coverage data files to .gitignore (*.profraw, *.profdata)
- Remove obsolete contrib/clang-coverage-report.sh
- Remove obsolete tests/conftest.py (now using pyln-testing markers)
- Update pyproject.toml to include pyln-testing in main dependencies

The new infrastructure automatically collects coverage data when CLN_COVERAGE_DIR
is set, organizing profraw files by test name for granular analysis.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 16:37:02 +01:00
ShahanaFarooqui
af5d02a9fa gitignore: Ignore lightning-downgrade and check-bolt tools
Changelog-None.
2025-12-03 06:24:04 -08:00
Rusty Russell
76ad32ec88 check-bolt: move to devtools, clean up tools/
And leave $(TOOLS) as user-visible tools.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-28 09:16:53 +10:30
Rusty Russell
35f65c5d91 common: add amount_msat_deduct / amount_msat_deduct_sub.
I added amount_msat_accumulate for the "a+=b" case, but I was struggling
with a name for the subtractive equivalent.  After some prompting, ChatGPT
suggested deduct.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-17 10:56:18 +10:30
ShahanaFarooqui
8fe749e881 gitignore: Add generated files to gitignore 2025-11-15 05:25:25 +05:30
Rusty Russell
8b9020d7b9 global: use clock_time in place of time_now().
Except for tracing, that sticks with time_now().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-13 21:21:29 +10:30
Rusty Russell
565f7deec0 connectd: at disconnected, tell lightningd how long we were connected.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-11-12 13:58:43 +10:30
Rusty Russell
82fff3c74b Remove litecoin support.
No idea if it works, we don't test it and nobody runs it.  I guess not.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: Config: non-functioning litecoin support (who knew we even had that?)
2025-10-26 20:31:45 +10:30
Rusty Russell
42f9361375 ccan: update to get improved grab_file API, and adapt code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-26 12:37:58 +10:30
Rusty Russell
c821e41085 common: assert that they don't call setup_tmpctx() twice.
Otherwise, leaks will occur.  And fix up dualopend and devtool/route,
which do this!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30
Rusty Russell
6e5cb299dd global: remove unnecessary includes from C files.
Basically, `devtools/reduce-includes.sh */*.c`.

Build time from make clean (RUST=0) (includes building external libs):

Before:
	real    0m38.944000-40.416000(40.1131+/-0.4)s
	user    3m6.790000-17.159000(15.0571+/-2.8)s
	sys     0m35.304000-37.336000(36.8942+/-0.57)s
After:
	real    0m37.872000-39.974000(39.5466+/-0.59)s
	user    3m1.211000-14.968000(12.4556+/-3.9)s
	sys     0m35.008000-36.830000(36.4143+/-0.5)s

Build time after touch config.vars (RUST=0):

Before:
	real    0m19.831000-21.862000(21.5528+/-0.58)s
	user    2m15.361000-30.731000(28.4798+/-4.4)s
	sys     0m21.056000-22.339000(22.0346+/-0.35)s

After:
	real    0m18.384000-21.307000(20.8605+/-0.92)s
	user    2m5.585000-26.843000(23.6017+/-6.7)s
	sys     0m19.650000-22.003000(21.4943+/-0.69)s

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30
Rusty Russell
bc44d3c629 devtools/reduce-includes.sh: don't remove our own .h from .c file includes.
Even if we would currently include it indirectly, we must include it directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30
Rusty Russell
f6a4e79420 global: remove unnecessary includes from headers.
Each header should only include the other headers it needs to compile;
`devtools/reduce-includes.sh */*.h` does this.  The C files then need
additional includes if they don't compile.

And remove the entirely useless wire/onion_wire.h, which only serves to include wire/onion_wiregen.h.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30
Rusty Russell
e120f87083 Makefile: create a library containing common, wire and bitcoin objects.
This means we don't have to manually choose what to link against,
which is much of the complexity of our Makefiles: the compiler will
automatically use any object files it needs to link.

We already do this for ccan as libccan.a, now we have libcommon.a.

We don't link against it for *everything*, as some tests require their own
versions.

Notes:
1. I get rid of the weird plugins/test/Makefile2 (accidental commit?)
2. Many tests change due to update-mocks.
3. In some places I added the missing dependency on the Makefile itself, though most are in the next
   patch.

Before:
	Total program size:     221366528
	Total tests size:       364243856

After:
	Total program size:     190733656
	Total tests size:       337880888

Build time from make clean (RUST=0) (includes building external libs):

Before:
	real    0m38.227000-44.245000(41.8222+/-1.6)s
	user    3m2.105000-33.696000(23.1442+/-8.4)s
	sys     0m35.054000-42.269000(39.7231+/-2)s
After:
	real    0m38.944000-40.416000(40.1131+/-0.4)s
	user    3m6.790000-17.159000(15.0571+/-2.8)s
	sys     0m35.304000-37.336000(36.8942+/-0.57)s

Build time after touch config.vars (RUST=0):

Before:
	real    0m18.928000-22.776000(21.5084+/-1.1)s
	user    2m8.613000-36.567000(27.7281+/-7.7)s
	sys     0m20.458000-23.436000(22.3963+/-0.77)s

After:
	real    0m19.831000-21.862000(21.5528+/-0.58)s
	user    2m15.361000-30.731000(28.4798+/-4.4)s
	sys     0m21.056000-22.339000(22.0346+/-0.35)s

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

rusty@rusty-Framework:~/devel/cvs/lightni
2025-10-23 06:44:04 +10:30
Rusty Russell
559e3fc447 common: fix bolt12 quotes to bring them up-to-date.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-01 15:31:30 +09:30
Rusty Russell
54444e4337 BOLT12: Update recurrence to latest spec draft.
Changes:
* Fields renumbered to their draft values + billion.
* offer_recurrence now comes in compulsory or optional (backwards compat) flavors.
* `proportional_amount` is now inside `offer_recurrence_base` not `offer_recurrence_paywindow`.
* New field `invreq_recurrence_cancel`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: Draft specification for recurring offers changed: old recurring offers will no longer work.
2025-10-01 15:31:30 +09:30
Rusty Russell
e7ea57e130 BOLT12: Remove start_any_period from recurrence_base.
Offer_absolute_expiry should be used if you want to require starting at the start.

Changelog-EXPERIMENTAL: Protocol: BOLT 12 recurrence `start_any_period` removed, use expiry if you need to restrict when they can start using the offer.
2025-10-01 15:31:30 +09:30
Rusty Russell
05005475e3 BOLT12: Remove years from recurrence.
Use months instead.

Changelog-EXPERIMENTAL: Protocol: BOLT 12 recurrence `years` removed; use 12 x months.
2025-10-01 15:31:30 +09:30
Rusty Russell
0e4b6ca109 gossip_store: wait for completed bit on reading.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-01 13:29:33 +09:30
Rusty Russell
d8db51d879 devtools: create conversion tool for old gossip stores.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-01 13:29:33 +09:30
Rusty Russell
9fb8870f92 gossip: add COMPLETED bit to mark records which are complete.
This should detect partial writes more robustly, since we make a
separate pwrite() call to update this flag after the record is written.

Previously we were playing a bit loose with synchronization assumptions,
which seemed to work on Linux ext4, but not so well elsewhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-01 13:29:33 +09:30
Rusty Russell
7aec8cec53 common: remove unused push bit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-01 13:29:33 +09:30
Matt Whitlock
41d31dcd19 avoid UB when calling ctype functions
The character classification functions in <ctype.h> are designed to
classify characters returned by <stdio.h> getchar() and friends, which
return characters as signed integers in the range 0 to 255 or EOF. The
behavior of the ctype functions is undefined if they are passed a value
outside of that range, which may happen if they are passed a char-typed
value and the system's char type is signed.

<ccan/str/str.h> defines some inline utility functions that perform the
necessary cast to coerce a char-typed argument into the allowed value
range. Call these wrappers instead of the bare ctype functions when
classifying char-typed characters.

Changelog-None
2025-08-18 14:03:20 +09:30