Commit Graph

15609 Commits

Author SHA1 Message Date
Rusty Russell
4b23ffa6f2 pytest: test askrene and making payments with channeld_fakenet.
Note the impedence mismatch between sendpay and getroutes: we have to shift
amounts and delays by 1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-06 21:17:36 +10:30
Rusty Russell
75362d21c5 channeld_fakenet: fake channeld to simulate network given a gossmap_store.
Our gossmap_store uncompresser generates nodeids with well-known
privkeys, so we can decrypt and respond to HTLCs sent to such nodes.
By replacing channeld with a fake, we can connect a node to another
node, but then once the channel is established, allow payments to be
sent into the generated network, and respond appropriately.

This minimal version handles MPP timeouts, but doesn't insert any
delays or runtime capacity for channels.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-None: Testing only
2024-11-06 21:17:36 +10:30
Rusty Russell
498111ed8c channeld: routine to feed in a shachain.
This will be used by channeld_fakenet to create replies from the peer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-06 21:17:36 +10:30
Rusty Russell
dca3a8c72c hsmtool: fix NULL secp256k1_ctx when calling dumpcommitments
secp256k1_ctx is used by pubkey_from_node_id.  Don't try to pick and
choose where to initialize secp256k1_ctx, just always do it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-06 21:17:36 +10:30
Rusty Russell
9980931208 doc: don't included stray .md files in index.rst
If you change branches and have a generated .md file, index.rst
will pick it up.  Use the Makefile variable, not the contents of
the filesystem!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-06 21:17:36 +10:30
Lagrang3
ba905f7e20 renepay: add test for description interface
Change-log: renepay: add test for description interface

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2024-11-06 09:59:27 +01:00
Lagrang3
2d9277a9a1 renepay: pay BOLT11 invoices with description_hash
This remove an unnecessary check for existing description field if the
description_hash is provided in the invoice. The bolt11_decode function
already checks the description against the hash if both are provided.

Changelog-Fix: renepay: allow to pay BOLT11 invoices with description_hash, the description field is made optional

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
2024-11-06 09:59:27 +01:00
ShahanaFarooqui
555376e5c7 Remove swagger postman screenshots including .github folder
Fixes: https://github.com/ElementsProject/lightning/issues/7691

Changelog-None.
2024-11-06 14:01:22 +10:30
ShahanaFarooqui
92064706c7 ci: Fixed handling of special characters in PR descriptions while searching for change log none. 2024-11-06 13:48:12 +10:30
ShahanaFarooqui
10898d97e5 script: Giantnode paths fix
Changelog-Fixed: Fixed regtest directory location for giantnode script.
2024-11-06 13:48:12 +10:30
Rusty Russell
b9c718f693 pytest: fix flake in test_sendpay_grouping
Now pay learns, it sometimes learns not to try again:

```
>       assert(len(l1.rpc.listpays()['pays']) == 2)
E       AssertionError: assert 1 == 2
E        +  where 1 = len([{'amount_sent_msat': 0, 'bolt11': 'lnbcrt1pnjj7mysp5tfx8n6nyx7ehszgqn7gqm2r6n079p22u2yddtg797ka3pa9557tspp5f89z6genjqrl3knymvav9ajwcxrm5w7arxux06rrhjux88derjyqdq8v3jhxccxqyjw5qcqp9rzjqgkjyd3q5dv6gllh77kygly9c3kfy0d9xwyjyxsq2nq3c83u5vw4jqqqvuqqqqsqqqqqqqqpqqqqqzsqqc9qxpqysgqcuyr7qlyctf9w96fqg4wetqt7t5v938dagmv0r777n902utjufujzjxl3289r97yngft966zly3ehxfp469dh3lq0hkv6r684snvunqppuyvsl', 'created_at': 1730771812, 'destination': '035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d', ...}])

tests/test_pay.py:5147: AssertionError
```

We fix this by creating a fresh channel, so it will try.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-05 17:04:21 +10:30
Rusty Russell
7aef05393c pytest: fix flake in test_onchain_reestablish_reply
We can see peer_in before the state changes:

```
         l3.daemon.wait_for_log("peer_in WIRE_ERROR")
>       assert only_one(l3.rpc.listpeerchannels(l2.info['id'])['channels'])['state'] == 'AWAITING_UNILATERAL'
E       AssertionError: assert 'CHANNELD_NORMAL' == 'AWAITING_UNILATERAL'
E         - AWAITING_UNILATERAL
E         + CHANNELD_NORMAL
```

From the logs, there is 0.2 seconds between them:

```
lightningd-3 2024-11-05T01:58:41.695Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#1: peer_in WIRE_ERROR
lightningd-3 2024-11-05T01:58:41.726Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#1: billboard perm: Received ERROR channel cecf36a62a09d4f1bdb42aa61d0770964bf3b245b8943a3e5b86dafc572f63d1: Forcibly closed by `close` command timeout
lightningd-3 2024-11-05T01:58:41.745Z UNUSUAL 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: Peer permanent failure in CHANNELD_NORMAL: channeld: received ERROR channel cecf36a62a09d4f1bdb42aa61d0770964bf3b245b8943a3e5b86dafc572f63d1: Forcibly closed by `close` command timeout (reason=protocol)
lightningd-3 2024-11-05T01:58:41.890Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: We have 3 anchor points to use
lightningd-3 2024-11-05T01:58:41.897Z DEBUG   lightningd: Broadcasting txid ff2f44b37d96a81fcaa2a4b11746a06be70f3f800fbce941e61a47abb61f70c0
lightningd-3 2024-11-05T01:58:41.901Z DEBUG   lightningd: sendrawtransaction: 02000000000101cecf36a62a09d4f1bdb42aa61d0770964bf3b245b8943a3e5b86dafc572f63d1000000000096b64c80044a01000000000000220020525df7a97bd0506c9ec41ee4e5f095e6e5316db01846a0a687404628017e88494a010000000000002200206db2ec9041ba3ccb6309dcad26015f32637e6869be09d3c3d3a1cb1439296f0b400d030000000000220020c2468acf761754e2533fcb13235326d1f1173b697b132048d6409be7818ed9a96a1f0c0000000000220020b1b561b95c1bccd50fb21bd417a95cabbc3efc351b1353063fe5e9f185d21c8a0400473044022036ab981a2642527c2019a4d15847f6b2fb1d0b92f1a2faff463ab109ed70c4d002205eeb0fcd610a9dba477ee7d66f02d0384080383fbb003d4ee423bdae0970b0430147304402202f7de3481ce00478e539cd9d6bac95ec3c80ec906c46ad2561118dca321b1458022048efd1aa04ff5fafbb99d14f7c9671072b035cbd2c031547793eb0cb6a62302d0147522102d595ae92b3544c3250fb772f214ad8d4c51425033740a5bcc357190add6d7e7a2102d6063d022691b2490ab454dee73a57c6ff5d308352b461ece69f3c284f2c241252ae6e14d920
lightningd-3 2024-11-05T01:58:41.907Z INFO    022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: State changed from CHANNELD_NORMAL to AWAITING_UNILATERAL
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-05 17:04:21 +10:30
Vincenzo Palazzo
e1eb5891c4 tests: fix the err msg check
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-11-03 21:38:10 +10:30
Vincenzo Palazzo
6309503692 bolt12: fix typo about parameters name in err str
Changelog-Fixed: bolt12: fix typo about parameters name in err str
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2024-11-03 21:38:10 +10:30
ShahanaFarooqui
93ba08a537 github: Check if change entry is logged in PR description 2024-11-03 13:15:13 +10:30
Rusty Russell
9b4699077c Github: Belated warning about 24.11 freeze.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-02 13:02:16 +10:30
Rusty Russell
183da392ca connectd: increase queue length to 250,000.
The original complaint which caused my investigation was the 100% CPU
consumption of connectd, which we traced to the queue to gossipd.

However, the issue is not really connectd's overproduction, but
gossipd's underconsumption, probably caused by its own queueing issues
with the trace messages to lightningd, which the prior patch fixed.

Nonetheless, gossipd *can* get busy, and if we were to ask multiple
nodes for full gossip, we could see a few hundred thousand messages
come it at once.  Hence I'm increasing the warning limit to 250,000
messages.

This commit is also where we attach the Changelog message, even
though it's really "common/msg_queue: use membuf for greater efficiency."
and "gossipd: fix excessive msg_queue length from status_trace()" which
solved the problem.

Here's the backtrace from a previous debug patch:

```
lightning_connectd: msg_queue length excessive (version v24.08.1-17-ga780ad4-modded)
0x5580534051f0 send_backtrace
        common/daemon.c:33
0x55805340bd5b do_enqueue
        common/msg_queue.c:66
0x55805340bde5 msg_enqueue
        common/msg_queue.c:82
0x5580534057ce daemon_conn_send
        common/daemon_conn.c:161
0x5580533fe3ff handle_gossip_in
        connectd/multiplex.c:624
0x5580533ff23b handle_message_locally
        connectd/multiplex.c:763
0x5580533ff2d6 read_body_from_peer_done
        connectd/multiplex.c:1112
```

Reported-by: https://github.com/JssDWt
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: `connectd` and `gossipd` message queues are much more efficient.
2024-11-01 16:54:49 +10:30
Rusty Russell
1efa0653e1 gossipd: fix excessive msg_queue length from status_trace()
When this (very spammy) "handle_recv_gossip" message was changed
from debug to trace, the suppression code wasn't updated: we suppress
overly active debug messages, but not trace messages.

This is the backtrace from an earlier version of the "too large queue"
patch:

```
lightning_gossipd: msg_queue length excessive (version v24.08.1-17-ga780ad4-modded)
0x557e521e833f send_backtrace
        common/daemon.c:33
0x557e521eefb9 do_enqueue
        common/msg_queue.c:66
0x557e521ef043 msg_enqueue
        common/msg_queue.c:82
0x557e521e891d daemon_conn_send
        common/daemon_conn.c:161
0x557e521f14f0 status_send
        common/status.c:90
0x557e521f1804 status_vfmt
        common/status.c:169
0x557e521f1433 status_fmt
        common/status.c:180
0x557e521de7c6 handle_recv_gossip
        gossipd/gossipd.c:206
0x557e521de9f5 connectd_req
        gossipd/gossipd.c:307
0x557e521e862d handle_read
        common/daemon_conn.c:35
```
2024-11-01 16:54:49 +10:30
Rusty Russell
1e4adbff17 common/msg_queue: send backtrace on oversize queues.
Scary looking, but great for debugging!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-01 16:54:49 +10:30
Rusty Russell
1051e97d69 common/msg_queue: use membuf for greater efficiency.
Based on CPU consumption in memmove with the current naive approach.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-11-01 16:54:49 +10:30
ShahanaFarooqui
859f795168 repro: focal modded fix
- Locked grpcio-tools version to fix dirty tree issue. Ref: https://github.com/ElementsProject/lightning/pull/7376#issuecomment-2161102381

- Updated python version to 3.10 for future proofing

- Added manual dispatch for github action
2024-10-31 20:26:30 -07:00
Se7enZ
814c838cae build: Repro build matrix strategy for focal, jammy and noble. ([#7117])
Changelog-None
2024-10-31 20:26:30 -07:00
Se7enZ
f7d3b0bf5a build: Nightly repro build for Ubuntu Noble. 2024-10-31 20:26:30 -07:00
Se7enZ
e004f0075e make: Add a phony version target to output version string. 2024-10-31 20:26:30 -07:00
Alex Myers
80d666b951 gossipd: drive-by correction of new channel announcement evaluation
According to the description, we should be checking the existence of a
channel update on the other side here.

Changelog-None
2024-11-01 13:13:30 +10:30
Rusty Russell
b327bd30c3 doc: fix all JSON schemas to enforce no additional properties.
Without this, we have hardly any enforcement.  This is why the schema
mistake fixed in the previous patches weren't spotted immediately.

The hard work was done by:

```
$ for f in lightning-*.json; do grep -v '^  "additionalProperties": false,' $f | bagto $f; done
$ for f in lightning-*.json; do sed 's/"properties": {/"additionalProperties": false, "properties": {/' $f | bagto $f; done
$ make fmt-schemas
```

Then checking where 'additionalProperties: true' had been turned to
false (we deliberately use it in some places where there are if
statements in the schema, or occasionally where there can be arbitrary
fields).

[Including doc/rpc-schema-draft.json update by Shahana]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-30 15:39:12 +10:30
Rusty Russell
7b2c791dcf doc: fix up missing fields from schemas.
This allows the next patch (which makes the schemas stricter) to not
break our tests.

We add some missing fields (including dev fields, but they're empty and hidden),
and add a few minor clarifications and a spelling fix.  Most of these are new
schemas for this release, so no mention in Changelog.

Here is the difference in the man pages:

    --- doc/lightning-askrene-inform-channel.7.md.old	2024-10-29 17:33:07.714521584 +1030
    +++ doc/lightning-askrene-inform-channel.7.md	2024-10-29 17:42:37.434280109 +1030
    @@ -24,6 +24,8 @@
     - **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction
    +- **layer** (string): The name of the layer to apply this change to.
    +- **timestamp** (u64): The UNIX timestamp when this constraint was created.
     - **maximum\_msat** (msat, optional): The maximum value which this channel could pass.
    --- doc/lightning-askrene-listlayers.7.md.old	2024-10-29 17:33:07.716521571 +1030
    +++ doc/lightning-askrene-listlayers.7.md	2024-10-29 17:42:37.424280316 +1030
    @@ -29,13 +29,16 @@
     - **channel\_updates** (array of objects):
    +  - **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction this update applies to.
    +  - **enabled** (boolean, optional): True if this can be used, false otherwise.
       - **htlc\_minimum\_msat** (msat, optional): The minimum value allowed in this direction.
       - **htlc\_maximum\_msat** (msat, optional): The maximum value allowed in this direction.
       - **fee\_base\_msat** (msat, optional): The base fee to apply to use the channel in this direction.
       - **fee\_proportional\_millionths** (u32, optional): The proportional fee (in parts per million) to apply to use the channel in this direction.
    -  - **delay** (u16, optional): The CLTV delay required for this direction.
    +  - **cltv\_expiry\_delta** (u16, optional): The CLTV delay required for this direction.
     - **constraints** (array of objects):
       - **short\_channel\_id\_dir** (short\_channel\_id\_dir): The short channel id and direction
    +  - **timestamp** (u64, optional): The UNIX timestamp when this constraint was created.
       - **maximum\_msat** (msat, optional): The maximum value which this channel could pass.
    --- doc/lightning-askrene-listreservations.7.md.old	2024-10-29 17:33:07.719521550 +1030
    +++ doc/lightning-askrene-listreservations.7.md	2024-10-29 17:42:37.428280233 +1030
    @@ -16,7 +16,7 @@
    -On success, an object containing **layers** is returned. It is an array of objects, where each object contains:
    +On success, an object containing **reservations** is returned. It is an array of objects, where each object contains:
    --- doc/lightning-autoclean-status.7.md.old	2024-10-29 17:33:07.732521462 +1030
    +++ doc/lightning-autoclean-status.7.md	2024-10-29 17:42:37.441279965 +1030
    @@ -9,7 +9,7 @@
     
    -The **autoclean-status** RPC command tells you about the status of the autclean plugin, optionally for only one subsystem.
    +The **autoclean-status** RPC command tells you about the status of the autoclean plugin, optionally for only one subsystem.
     
    --- doc/lightning-renepay.7.md.old	2024-10-29 17:33:07.927520140 +1030
    +++ doc/lightning-renepay.7.md	2024-10-29 17:42:37.996268504 +1030
    @@ -58,6 +58,9 @@
     - **status** (string) (one of "complete", "pending", "failed"): Status of payment.
    +- **bolt11** (string, optional): The bolt11 invoice paid. *(added v23.08)*
    +- **bolt12** (string, optional): The bolt12 invoice paid. *(added v23.08)*
    +- **groupid** (u64, optional): The groupid used for these payment parts (as can be seen in listsendpays) *(added v23.08)*
     - **destination** (pubkey, optional): The final destination of the payment.
    --- doc/lightning-sendonion.7.md.old	2024-10-29 17:33:07.937520073 +1030
    +++ doc/lightning-sendonion.7.md	2024-10-29 17:42:37.957269309 +1030
    @@ -22,7 +22,7 @@
    -- **first\_hop** (object): Instructs Core Lightning which peer to send the onion to. It is a JSON dictionary that corresponds to the first element of the route array returned by *getroute*.:
    +- **first\_hop** (object): Instructs Core Lightning which peer to send the onion to. It is a JSON dictionary that corresponds to the first element of the route array returned by *getroute* (so fields not mentioned here are ignored).:
    
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: `renepay` return fields documented in schema (`bolt11`, `bolt12` and `groupid`)
2024-10-30 15:39:12 +10:30
Rusty Russell
fd860f69f8 doc: fix schema for askrene-update-channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-30 15:39:12 +10:30
Rusty Russell
916a36a9e4 lightningd: new command injectpaymentonion.
This is like `sendonion` but unwraps the onion as the first hop,
avoiding nasty special cases for blinded paths which start with this
node, and also self-pay.

Tests split into multiple ones after Christian's review.

Changelog-Added: JSON-RPC: `injectpaymentonion` for initiating an HTLC like a peer would do.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-27 13:57:50 +11:00
Rusty Russell
6bfebf4307 lightningd: refactor payment failed.
Don't assume we have an outgoing HTLC at this level.

Note that previously we didn't save the failed onion unless it was
unparsable: we keep that both for space savings and because our
`waitsendpay` logic assumes that when it fetches from the db if
there's a failonion it was unparsable!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-27 13:57:50 +11:00
Rusty Russell
851d8733c6 pytest: generalize serialize_payload_tlv/serialize_payload_final_tlv
Put these in utils and make them a bit more powerful, so we can use
them elsewhere.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-27 13:57:50 +11:00
Rusty Russell
6a8e8b2dc9 lightningd: generalize waitsendpay_command so we can use it for injectpaymentonion.
Rather than assuming the callbacks, make them function pointers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-27 13:57:50 +11:00
Rusty Russell
93c1876d1e lightningd: generalize htlc_set.
Make it a set of arbitrary data, so we can use it for local payments,
not just HTLCs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-27 13:57:50 +11:00
Rusty Russell
41610d7bab lightningd: allow htlc_set_fail to take empty msg to send incorrect_or_unknown_payment_details
This message is supposed to include the msat amount received.  But this is
obviously per-HTLC, and we hacked it to use the value for the first one.

And we add logging whenever we fail an HTLC set, since we removed logging
by not calling failmsg_incorrect_or_unknown() (which, now, no longer needs
to log).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-27 13:57:50 +11:00
Rusty Russell
fdb3f5fe1b lightningd: make failmsg_incorrect_or_unknown take amount, not htlc_in.
This makes it slightly more generic.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-27 13:57:50 +11:00
Se7enZ
4017844d0c lightningd: listforwards returns 0 for missing received_time. ([#7157])
Removes the `COMPAT_V070` functionality for `listfowards`.

Changelog-Changed: The `listforwards` command will now return a value
of 0 for `received_time` for very old forward attempts.
2024-10-26 09:51:20 +02:00
Se7enZ
3a363df5fb docs: Fix openchannel_abort generated JSON schema.
Changelog-None
2024-10-25 12:13:32 -07:00
Lakshya Singh
9c5e1ca82c docs: openchannel_abort correction
Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
2024-10-23 22:01:33 +02:00
Se7enZ
4f5ea34461 doc: gRPC SSL custom certificate generation instructions with SANs.
Changelog-Added: Example documentation on generating custom gRPC
certificates with SANs.
2024-10-21 13:58:42 -07:00
Se7enZ
35cda77b3b doc: Fix gRPC custom certificate anchor links. 2024-10-21 13:58:42 -07:00
Joseph Goulden
34187bbf9d doc: Add nix flake documentation to developers guide 2024-10-21 16:56:02 +02:00
Joseph Goulden
d49b5a53fb build: Add cln-postgres package to nix flake 2024-10-21 16:56:02 +02:00
Joseph Goulden
f31a8cf749 build: Update .version as part of the release 2024-10-21 16:56:02 +02:00
Joseph Goulden
fe7168b335 build: Exclude python plugins from flake build 2024-10-21 16:56:02 +02:00
Joseph Goulden
864ece025e build: Add nix derivation for building cargo workspace 2024-10-21 16:56:02 +02:00
Joseph Goulden
2056478e56 build: Add simple flake
Changelog-Added: Nix users can now install CLN from the new flake.
2024-10-21 16:56:02 +02:00
alfredo-toledano
3c3008c5cc doc(README.md): fix typo about supported installation options
Changelog-None
2024-10-21 12:40:28 +02:00
Emmanuel Ferdman
2cb590643f doc: update reference to the generator code
Changelog-None.

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-10-18 14:01:33 -07:00
ShahanaFarooqui
4f0f84661e release: Update the changelog for point release v24.08.2
Changelog-None.
2024-10-18 09:06:17 -07:00
ShahanaFarooqui
2171583d47 doc: Fix documentation version
Changelog-Fixed: The documentation version was calculated as `pre-v24.08` for point releases like v24.08.1` also because `CLN_NEXT_VERSION` has not been included in the point release branches. Updating the script to build documentation on new tags and change the version to `pre-cln-next-version` for non-tagged commits.
2024-10-17 06:48:08 +10:30