Commit Graph

1446 Commits

Author SHA1 Message Date
Lakshya Singh
f442bd5012 fix: flake8 lint rules
Remove unnecessary global declarations across multiple test files. 
This change improves code quality by eliminating redundant global 
statements for variables that are already accessible in their 
respective scopes. Add proper type annotation for fees_from_status 
in test_closing.py and import the required typing modules. These 
changes maintain the same functionality while making the code cleaner 
and more compliant with Python best practices.
2025-08-11 11:06:22 +09:30
Lakshya Singh
6088a0e49a feat: add __init__.py in packages
allows for namespace sharing in a virtual environment otherwise gets overriden by pyln-proto-grpc's pyln folder
2025-08-11 11:06:22 +09:30
Lakshya Singh
c56464ca08 refactor: pyproject.toml poetry to uv + hatch
make use of standard keys for project and dependeny specification

- provide sources to run uv build so that it can refer local packages
- using hatchling for build as is stock build option
- use optional-dependencies.dev for dev-dependencies
- add hatch targets for packages and includes where unclear

Changelog-Update: use uv with hatchling instead of poetry
2025-08-11 11:06:22 +09:30
daywalker90
2e7181d04f wss-proxy: replaced by a rust version
Changelog-Changed: wss-proxy.py was replaced by a rust version with support for multiple `wss-bind-addr`. If you install CLN from pre-compiled binaries you must remove the old wss-proxy directory first before installing CLN, usually
it is located in `/usr/local/libexec/c-lightning/plugins/wss-proxy`. If you compile from source `make` will take care of this automatically.
2025-07-24 12:42:06 -07:00
Lagrang3
73f03318bd askrene: update the docs on auto.no_mpp_support
Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2025-07-18 15:13:41 +09:30
ShahanaFarooqui
87d862992a doc: Remove c-lightning-REST documentation
Changelog-None
2025-07-10 15:51:42 +09:30
Dusty Daemon
b4d0da5ff4 logs: A basic javascript log viewer
A basic javascript tool for filtering through large CLN log files.

Changelog-Added: A new tool for rendering CLN log files in the browser.
2025-07-08 12:24:24 +09:30
Rusty Russell
c50bd381ec doc: recommend injectpaymentonion in place of sendonion.
Among other things, injectpaymentonion insists on knowing the destination
amount_msat.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-06-30 13:23:26 +09:30
Rusty Russell
89f411ca79 doc: be explicit (with tests!) on when we don't know amount_msat for listsendpays.
Sangbida and I traced back through ancient history: when the pay plugin was introduced
in 0.9.0 (2019!) it already used the amount_msat parameter (then called `msatoshi`),
so this case effectively "never happens".

But we added a test for it just in case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-06-30 13:23:26 +09:30
Rusty Russell
50e4aabe18 commando: remove old commando rune commands.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON-RPC: `commando-rune`, `commando-listrunes`, `commando-blacklist` (deprecated v23.08, disabled v25.05).
2025-06-25 09:06:31 +09:30
Rusty Russell
884778635c deprecations: update v26.05 to v26.06.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Future release schedule moved one month: v25.05 is now v25.06, and all deprecations incremented accordingly.
2025-06-24 09:57:24 +09:30
Rusty Russell
094ac3518f deprecations: update v26.02 to v26.03.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-06-24 09:57:24 +09:30
Rusty Russell
09e03e98ef deprecations: update v25.11 to v25.12.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-06-24 09:57:24 +09:30
Alex Myers
2b8b709bfd meta: update changelog for v25.05
Changelog-None
2025-06-16 13:10:33 -05:00
daywalker90
40d319b7be python: raise minimum supported python version to 3.9
Changelog-None
2025-06-12 13:51:18 +02:00
daywalker90
b97278fb9a python: upgrade grpcio-tools to 1.69.0 and protobuf to 5.29.4 for python3.13 compatibility
Changelog-None
2025-05-21 10:58:15 -05:00
Alex Myers
8d6ae149ff release: update version for 25.05rc1
Changelog-None
2025-05-19 14:12:55 -05:00
daywalker90
529337a5fb msggen: add signmessagewithkey
Changelog-None
2025-05-15 13:04:13 +02:00
Matt Whitlock
968bb63739 doc: properly handle ``preformatted blocks``
Lowdown requires a blank line before all preformatted blocks, or it doesn't
recognize them. `tools/md2man.sh` contained some ad-hoc efforts at fixing up
some locations where these required blank lines are absent from the output of
`tools/fromschema.py`, but it missed some. Instead of playing Whack-a-Mole, use
a blanket sed expression to ensure that a blank line precedes _every_ opening
```.

`esc_underscores(…)` in `tools/fromschema.py` did not work correctly on strings
containing an odd number of backticks, notably the ``` delimiters surrounding
preformatted text blocks. Specifically, it was dropping the last backtick since
none of the alternatives in the regex matched it. Add a new alternative that
matches a whole preformatted block as a single unit.

`output_member(…)` in `tools/fromschema.py` was passing each line of a member's
description through `esc_underscores(…)` individually, but that breaks
preformatted text blocks that are naturally multi-line and leads to mistakenly
escaping underscores inside such blocks. Rewrite the code to make use of the
`outputs(…)` utility function that joins all the provided lines together before
passing the whole text through `esc_underscores(…)`.

Drive-by fix a couple of flubbed preformatted blocks in schemas.

[ Added shellcheck suppression for md2man.sh --RR ]
Changelog-None
2025-05-15 16:06:08 +09:30
Rusty Russell
b3b9d93fb0 pytest: fix flake in test_update_fee_reconnect.
If we grab l2's scratch_txid too early, it might not be the one which goes in the mempool:

```
2025-05-12T05:15:44.3947957Z     def test_update_fee_reconnect(node_factory, bitcoind):
...
2025-05-12T05:15:44.3962867Z         # Now shutdown cleanly.
2025-05-12T05:15:44.3963253Z         l1.rpc.close(chan)
2025-05-12T05:15:44.3963591Z     
2025-05-12T05:15:44.3963905Z         # And should put closing into mempool.
2025-05-12T05:15:44.3964671Z         l1.wait_for_channel_onchain(l2.info['id'])
2025-05-12T05:15:44.3965175Z >       l2.wait_for_channel_onchain(l1.info['id'])
2025-05-12T05:15:44.3965496Z 
2025-05-12T05:15:44.3965659Z tests/test_connection.py:2634: 
...
2025-05-12T05:15:44.3966616Z contrib/pyln-testing/pyln/testing/utils.py:1216: in wait_for_channel_onchain
2025-05-12T05:15:44.3967080Z     wait_for(lambda: txid in self.bitcoin.rpc.getrawmempool())
2025-05-12T05:15:44.3967429Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2025-05-12T05:15:44.3967631Z 
2025-05-12T05:15:44.3967888Z success = <function LightningNode.wait_for_channel_onchain.<locals>.<lambda> at 0x7f0562d7f0a0>
2025-05-12T05:15:44.3968299Z timeout = 180
2025-05-12T05:15:44.3968408Z 
2025-05-12T05:15:44.3968515Z     def wait_for(success, timeout=TIMEOUT):
2025-05-12T05:15:44.3968805Z         start_time = time.time()
2025-05-12T05:15:44.3969041Z         interval = 0.25
2025-05-12T05:15:44.3969251Z         while not success():
2025-05-12T05:15:44.3969510Z             time_left = start_time + timeout - time.time()
2025-05-12T05:15:44.3969794Z             if time_left <= 0:
2025-05-12T05:15:44.3970278Z >               raise ValueError("Timeout while waiting for {}".format(success))
2025-05-12T05:15:44.3970894Z E               ValueError: Timeout while waiting for <function LightningNode.wait_for_channel_onchain.<locals>.<lambda> at 0x7f0562d7f0a0>
```
2025-05-14 12:19:10 +09:30
ShahanaFarooqui
52a9bb1007 Separate reckless utility (1) and reckless rpc (7) documentation
Changelog-None.
2025-05-13 19:11:27 +09:30
Lagrang3
a90de8dcc7 sendonion: add total_amount_msat parameter
Changelog-Added: sendonion: a new paramter total_amount_msat to make MPP payments with sendpay and sendonion compatible.

[ Reordered to put new parameter at the end --RR ]
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2025-05-13 15:00:50 +09:30
Lagrang3
50cdf05a4a add signmessagewithkey RPC
signmessagewithkey: allows to sign a message with a key associated with
one bitcoin address in our wallet.

Changelog-Added: add a new rpc command signmessagewithkey to sign input messages with keys from our wallet.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2025-05-13 13:19:03 +09:30
Rusty Russell
99ef16fd71 doc: clarify that all with utxos spends all those utxos only.
Reported-by: https://github.com/michaelWuensch
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-None: trivial
2025-05-12 13:00:50 +09:30
Rusty Russell
9ce3f5dde4 askrene: fix API breakage, add tests.
We cannot add new parameters in the middle, since we accept parameters by JSON
array as well as by dicts.  In fact, this broke tests, but due to unrelated
breakage in the GitHub "Automerge" functionality, it got applied as
556e38c838 ("askrene-bias-channel: bias call add
up.").

Also add tests, and a better Changelog line.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `askrene-bias-channel` now has a `relative` option to add, rather than replace, a channel bias.
2025-05-11 11:25:40 +09:30
Alex Myers
8da55128ed misc: update Alex's gpg key
A subkey needed updating.

Changelog-None
2025-05-09 13:03:51 -05:00
Rusty Russell
e20efa17e2 msggen: regenerate.
Somehow GitHub's "Enable auto-merge" merged the PR without it actually passing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-08 13:10:41 +09:30
Lagrang3
556e38c838 askrene-bias-channel: bias call add up.
The channel bias feature is not being used yet by any plugin, so this
hopefully doesn't break any working code.
When askrene-bias-channel is called the bias quantity is added on top of
any previous biased already present on that channel instead of
overwriting it.

Changelog-Changed: askrene-bias-channel: bias call add up.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2025-05-08 12:28:57 +09:30
Rusty Russell
c81ec4fe76 lightningd: deprecate (undocumented!) "unknown" old_state field in channel_state_changed notification.
Reported-by: daywalker90
Changelog-Deprecated: JSON-RPC: channel_state_changed notification field `old_state` value "unknown" (it will be omitted, instead)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-08 10:49:31 +09:30
Rusty Russell
74e7264d54 bitcoin: make input witness weight calculation explicit.
This is inspired by a patch from @whitslack, which overlapped with this series.
Most importantly, there was only one call to bitcoin_tx_simple_input_weight(),
and it is better to be explicit with that one.

This also changes our funder calculation to assume our own input is taproot,
which it is likely to be given we've defaulted to taproot for outputs for
change addresses since 23.08.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-06 12:27:53 +09:30
Rusty Russell
94a247d982 pyln-testing: fail typecheck gracefully on integer.
We say the offer amount arg can be either an `msat_or_any` or a `currency` string, but technically the order of evaluation is undefined, so it can check the other way, and it should not crash:

```
>       offer = l3.rpc.offer(1000, 'test_pay_blindedpath_nodeaddr')

tests/test_pay.py:5692: 
...
checker = <TypeChecker types={'array', 'bip340sig', 'boolean', 'currency', 'feerate', 'hash', 'hex', 'integer', 'msat', 'msat_or..._all', 'secret', 'short_channel_id', 'short_channel_id_dir', 'signature', 'string', 'txid', 'u16', 'u32', 'u64', 'u8'}>
instance = 1000

    def is_currency(checker, instance):
        """currency including currency code"""
        pattern = re.compile(r'^\d+(\.\d+)?[A-Z][A-Z][A-Z]$')
>       if pattern.match(instance):
E       TypeError: expected string or bytes-like object

```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-05 12:44:46 -07:00
Lagrang3
e848f1019e startup_regtest: show "trace" events in the logs
Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2025-05-02 13:59:13 -07:00
21M4TW
3da1bdb368 pyln-client: Adding disableoffer, enableoffer, fetchinvoice, listoffers and offer commands
Changelog-None.
2025-05-02 13:57:04 -07:00
Rusty Russell
1dee02c5e3 pyln-client: reimplement NodeVersion, simply.
This broke my build machine, because lightningd --version was malformed
(I had no tags somehow in that branch).

I dived into the code to figure out what was wrong, and I was horrified.

1. STOP.  Never write this much code.
2. You just need a NodeVersion class.  That's it.  No others.
3. Don't throw away the entire first part if it starts with 'v'.  Just remove the v.
4. Handle untagged versions cleanly.
5. Always fail on invalid strings in the constructor, NOT on the first time you
   use it.

I have rewritten it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-05-02 13:48:02 -07:00
Alex Myers
52ac01db25 Dockerfile: lock poetry installation to v2.0.1
This avoids the docker image builders breaking with:
ERROR [linux/amd64 builder 15/17] RUN poetry export -o requirements.txt --without-hashes
0.780 pyproject.toml changed significantly since poetry.lock was last generated. Run Resolving dependencies... to fix the lock file.

This occurred when the default installation version changed underneath us.

Changelog-None
2025-05-02 13:39:33 -07:00
Alex Myers
a4e0091565 poetry: update all pyproject.toml files for poetry 2.0.1
and run poetry lock

Changelog-None
2025-05-02 13:39:33 -07:00
Rusty Russell
6bf36915fd lightningd: support index/start/end pagination for listhtlcs.
Changelog-Added: JSON-RPC: `listhtlcs` supports `index`, `start` and `end` parameters for pagination support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-04-29 09:38:20 +09:30
Rusty Russell
7ba6263c48 lightningd: add created_index and updated_index to listhtlcs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `listhtlcs` has `created_index` and `updated_index` fields.
2025-04-29 09:38:20 +09:30
Rusty Russell
9636553c16 lightningd: wait interface for htlcs indexes.
Note that documentation says invoice expiries can batch, but that's no
longer true, so delete it.  Usually, we miss a number because the
change is too fast.

This adds the wait interface, but it doesn't actually fire until the next
commit, which wires it into the db code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `wait` now supports the `htlcs` (`listhtlcs`) subsystem.
2025-04-29 09:38:20 +09:30
Rusty Russell
db104aae92 lightningd: improve wait API by making details fields per-subsystem.
It makes the schema simpler, and indeed, expressable by GRPC.

Changelog-Added: JSON-RPC: `wait` now has separate `invoices`, `forwards` and `sendpays` objects for each subsystem.
Changelog-Deprecated: JSON-RPC: `wait` reply `details` object: use subsytem specific object instead.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-04-29 09:38:20 +09:30
Rusty Russell
8974375de8 lightningd: add short_channel_id option to listpeerchannels.
Requested-by: @whitslack
Closes: https://github.com/ElementsProject/lightning/issues/8233
Changelog-Added: JSON-RPC: `listpeerchannels` now has a `short_channel_id` parameter for just listing a specific channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-04-28 14:13:12 +09:30
Lakshya Singh
e4a16800ab fix: workaround for macOS AF_UNIX path error
@pytest.mark.openchannel('v1')
    @pytest.mark.openchannel('v2')
    def test_pay(node_factory):
>       l1, l2 = node_factory.line_graph(2)
...
FAILED tests/test_pay.py::test_pay - OSError: AF_UNIX path too long

Changelog-None: symlink the socket to a tempfile which has a shorter path

Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
2025-04-21 11:45:15 +02:00
ShahanaFarooqui
2a8cc352f7 plugins: Updated Makefile for SQL plugin 2025-04-15 15:17:14 +09:30
ShahanaFarooqui
ad6a599d51 schemas: remove lightning- prefix from filename
This commit will fail in `make` due to unchanged scripts. They will be added in the next commit.
2025-04-15 15:17:14 +09:30
Rusty Russell
498c789c67 pyln-testing: routines to save/restore entire blockchain.
Good for making test snapshots.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-04-02 11:22:54 +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
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
c05ffb2fb1 doc: remove documentation for disabled commando commands.
When we update the CLN_NEXT_VERSION, these will only be available with --i-promise-to-fix-broken-api-user.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-12 09:26:08 +10:30
Alex Myers
427c4c5ce0 meta: update changelog for 25.02
Changelog-None
2025-03-04 20:58:46 -06:00
Alex Myers
3f81dc0221 meta: update CHANGELOG for 25.02rc3
Changelog-None
2025-02-27 15:14:41 -06:00