Commit Graph

14134 Commits

Author SHA1 Message Date
daywalker90
56d42ea767 rust: use "map_or" instead of "if let"
Co-authored-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-12-16 12:11:14 +01:00
Rusty Russell
09c1cfde39 pyln-client: don't automatically turn JSON into Millisatoshi class.
Now _msat fields are all integers (last conversion 23.08) we can simply
leave them alone, rather than trying to convert them.

And for turning Millisatoshi into JSON, we simply globally replace the
default encoding function to try ".to_json()" on items, which allows
anything to be marshalled.

The global replacement was interfering with other uses of JSON, such
as the clnrest plugin.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: pyln-client: no longer autoconverts _msat field to Millisatoshi class (leaves as ints).
2023-12-16 10:22:01 +01:00
Rusty Russell
8b224b6ec2 pytest: don't assume that msat fields get turned into Millisatoshi.
Since the class interacts with int very well now, we don't have to
make explicit accesses, so it's easy to write code which works with
Millisatoshi or int.

Also, don't access rpc.decoder in one test, it's unnecessary.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-16 10:22:01 +01:00
Erik De Smedt
4f089accba Update pyln-testing cheroot dependency
Using `pyln-testing` with `python3.11` results in the following warning.

```
.../venv/lib/python3.11/site-packages/cheroot/__init__.py:7: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    import pkg_resources
```

I've updated the `cheroot`-dependency.

However, the changes will not take effect immediately because we are
facing an internal conflict.

This conflict comes from the following requirements
- `//contrib/pyln-testing/pyproject.toml` requires `cheroot`. We can pick
  the requried version
- `./external/lnprototest/pyproject.toml` requires `pyln="^0.12"` requires
  `cheroot="^8"

It appears we have to do a multi-stage upgrade here.

**Step 1**
This commit configures `./contrib/pyln-testing/pyproject.toml`
to require `cheroot=">=8 <=10`. This allows users of `pyln-testing`
to start using a new release of `cheroot` immediately.

However, we still require `cheroot="^8"` because of `lnprototests`.
Even after running `poetry install` in the project root the warning
will remain.

**Step 2**
Not a part of this commit.

Publish a new release of `pyln-testing` on PyPI.

Once this release is finished we can update
`./external/lnprototests/pyproject.toml` to use the new
version of `pyln-testing` and the warning will disappear.
2023-12-16 12:28:55 +10:30
Adi Shankara
28671c14ac Update and rename backup-and-recovery.md to backup.md
Update title and filename since we moved out recovery to a new page.
2023-12-16 12:28:08 +10:30
Adi Shankara
549b3b96aa Update recovery.md
Using sentence case in title
2023-12-16 12:28:08 +10:30
ShahanaFarooqui
ab77030cbe doc: Recovery using database
- Adds instructions to recover the wallet with database
- Breaks the recovery subtitle into separate page

Changelog-None.
2023-12-16 12:28:08 +10:30
Erik De Smedt
36f69a1a98 Docs: Add custommsg notification 2023-12-16 11:36:42 +10:30
Erik De Smedt
375985bf6c Implement tests for notifications on custommsg 2023-12-16 11:36:42 +10:30
Erik De Smedt
1ae16bfaa5 Create notification on customssg
Create a notification that is triggered when a `costummsg` is received.

Changelog-Added: Plugins: notification custommsg for receiving an unknown protocol message
2023-12-16 11:36:42 +10:30
Adi Shankara
3391bd1a72
Publish code-generation.md (#6948)
Set the hidden tag to false and make this article public.
2023-12-15 15:10:16 +00:00
Christian Decker
328863e6be tracing: Add an example exporter to zipkin and document it 2023-12-15 13:23:51 +10:30
Christian Decker
3fa2ec7e7e test: Add a run-trace test and document tracing overhead 2023-12-15 13:23:51 +10:30
Christian Decker
7ce0942ee2 common: Add trace_cleanup() function for unit tests 2023-12-15 13:23:51 +10:30
niftynei
7717f6e4df psbt-fix: set to NULL, which will cleanup dangling pointer
On July 18th, @jgriffiths wrote:

> You need to set this to NULL after freeing it, otherwise if line 72 returns you have a dangling pointer and potential later use-after-free here. Alternately use wally_psbt_set_input_final_witness(NULL) which will free any existing witness and set the value to NULL.

Reported-By: @jgriffiths
2023-12-15 10:20:19 +10:30
ShahanaFarooqui
b250bca429 doc: documentation update for hooks and testing
Changelog-None.

Based upon suggestions:
https://dash.readme.com/project/blockstream-core-lightning/v1/suggested/update/655c70ab0077d2003b3b657b
https://dash.readme.com/project/blockstream-core-lightning/v1/suggested/update/655c8b912adff80063e82be8
2023-12-15 10:19:14 +10:30
Erik De Smedt
151a431628 Docs: Consistent whitespace in developers guide
The example used a mix of whitespace and tabs to format the JSON
which made it appear poorly on my device.
2023-12-15 10:18:04 +10:30
evansmj
7d52d4135e Sync bind-addr docs
In the original [$6173] pr `bind` was a typo for `bind-addr`.
`bind` never existed, so this commit updates uses of `bind` to `bind-addr`.
This links lightningd-config.5.md to configuration.md since `bind-addr` has options of interest such as ipv4/ipv6.
2023-12-15 10:03:10 +10:30
Christian Decker
05105d404c rs: Bump versions of cln-plugin and cln-rpc 2023-12-15 10:01:57 +10:30
Christian Decker
c8fd911e79 grpc: Add metadata to Cargo.toml 2023-12-15 10:01:57 +10:30
Christian Decker
a55c1edd66 pyln: Also generate type stubs in pyln-grpc-proto 2023-12-15 10:01:57 +10:30
Christian Decker
c7da72cd39 gci: Upload to test.pypi.org only from master
Turns out that if we publish from PRs we may end up with versioning
collisions, causing errors. This publishes only from `master` where we
have a linearizable history, and should therefore get unique versions.

Changelog-None
2023-12-15 10:01:57 +10:30
arowser
34a32361a8 build: 32-bit status_debug fix 2023-12-15 10:00:16 +10:30
Adi Shankara
dfd18fa2f1 fix typo 2023-12-15 09:55:26 +10:30
Adi Shankara
d50d7d428d fix typos and add suggested edits from community 2023-12-15 09:55:26 +10:30
Dusty Daemon
6f4a3c86e9 splice: Agressive restart testing during splices
Test node restarts in lots of phases of splice.

Changelog-None
2023-12-15 09:42:45 +10:30
Erik De Smedt
1754858ca7 Doc fix: dynamic options
When the value of a `dynamic` option is updated core Lightning
will make a JSON-RPC request to the plugin.

The documentation falsely mentioned the request has a method named
`setvalue. It appears it is actually called `setconfig`.
2023-12-15 09:40:29 +10:30
Erik De Smedt
557b5fee46 Allow dynamic option in python plugin 2023-12-14 16:48:02 +01:00
Christian Decker
b6c486c2ba gha: Add --skip-existing option to publish to testpypi
Changelog-None
2023-12-14 13:03:55 +01:00
Rusty Russell
36b631699b plugins: re-enable listchannels local info in deprecated mode.
We only deprecated this, we didn't actually remove it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
c8e30de513 topology: deprecate overriding active in listchannels with listpeerchannels info.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: `listchannels` no longer uses local knowledge to set `active` to false if disconnected.
2023-12-14 09:16:56 +10:30
Rusty Russell
4b92c773df common: gossmap now always ignores private gossip_store messages.
In the next PR, they'll be removed, but for now all our code doesn't
want them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
58a1c4c012 topology: don't show private nodes in listchannels.
This alters a few remaining tests, as well.

[ Inclused even more test fixes from Alex Myers <alex@endothermic.dev>! ]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Deprecated: JSON-RPC: `listchannels` listing private channels: use listpeerchannels
2023-12-14 09:16:56 +10:30
Alex Myers
3a6b9f2ec6 pytest: skip test_hook_crash on liquid CI 2023-12-14 09:16:56 +10:30
Rusty Russell
b318811a2d pytest: fix tests in assumption that listchannels will no longer show private gossip.
Some can only be changed once that is true, but some can be removed/amended already.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
ea0d00e677 topology: don't show private nodes in listnodes.
This breaks our tests a bit, which assumed we can always see ourselves
even if we don't have a proper channel.

Usually we would deprecate this first, but it's unlikely to break
anyone since it's a bit obscure that this worked at all.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `listnodes` no longer shows private (peer) nodes: use listpeers
2023-12-14 09:16:56 +10:30
Rusty Russell
f61ba7b332 pytest: remove test waits for routehints.
Now listincoming sees local channels in listpeerchannels, we don't need these waits.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
6ee59629f9 lightningd: make listincoming use gossmods_from_listpeerchannels().
We temporarily use a second gossmap so we can just switch private info off
for listincoming and not listchannels.

Note that listchannels now uses the local alias (if no scid), so we have
to change that in the routehint caller.

Since we now *always* use a channel alias in hints if one exists, a
test broke, so fix that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
0c949dcd04 lightningd: permit wrong-alias lookups for private channel_update.
This is wrong, but we send them for now in zeroconf!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
f3b4821d36 pytest: fix test_zeroconf_open()
l2 gave us a routehint, but it should have seen l1 as a dead-end.  It
didn't due to the presence of a channel alias, which was a bug.  We're
about to fix this, which breaks the test.

Add a dummy node off l1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
bac02b462b plugins/renepay: use gossmods_from_listpeerchannels instead of private gossip_store records.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
c8eb46fe30 plugins/renepay: add localmods later.
We will get localmods from gossmods_from_listpeerchannels in the next commit,
so we need to save routehints to add to that later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
7c26f140d8 common: add tests that json_scan can omit an entire object member.
We can, but I had a typo and thought we couldn't!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
8738d78c86 plugins/pay: use gossmods_from_listpeerchannels instead of private gossip_store records.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
3fdae99524 libplugin-pay: make sure get_gossmap calls are balanced by put_gossmap.
This will become important when we apply localmods to the gossmap at these points.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
a5c0563612 plugins/fetchinvoice: use gossmods_from_listpeerchannels instead of private gossip_store records.
[ Includes use-after-free fix from Alex Myers <alex@endothermic.dev> ]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
5256690c6f plugins/topology: temporary hack to allow per-access private gossmap suppression.
We have multiple different routines here, and we want to wean them off private
gossip one at a time.  This converts `getroute`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
cdaad1bf2a common: generic routine to turn listpeerchannels into gossmap local updates.
This is more thorough than the minimal one required for getroute(), including the feerates
and cltv deltas.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
f2fff4de55 gossmap: insert temporary per-caller flag to turn off private gossip.
This lets us convert one user at a time.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30
Rusty Russell
1d9a6d1efa pyln-testing: when waiting for active channel, make sure remote has sent fee info.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-12-14 09:16:56 +10:30