Commit Graph

14433 Commits

Author SHA1 Message Date
vacwmX d1052e3924 doc: adding schema to create offer requests 2024-02-07 20:38:29 +01:00
vacwmX 5eacb5b22e feat: adding offer command to pyln-testing and msggen 2024-02-07 20:38:29 +01:00
vacwmX 68bb1ff586 feat: grpc - adding support for `Offer` command 2024-02-07 20:38:29 +01:00
vacwmX 3ae3243517 fix: fixing start_any_period type for offer recurrence 2024-02-07 20:38:29 +01:00
Alex Myers 61e1e0c89c doc: update reckless documentation 2024-02-07 13:24:34 +01:00
Alex Myers 140e33b13a pytest: add tests for pip and poetry installed virtual envs
Also test checkout of a git tag on installation.
2024-02-07 13:24:34 +01:00
Alex Myers 3879d7b9bd reckless: update timeouts 2024-02-07 13:24:34 +01:00
Alex Myers 90a20ff6e3 reckless: create virtual environments for python plugins
This uses pip to install to a venv when the dependencies are specified
with requirements.txt and poetry when it's present on the system and the
plugin has a pyproject.toml.

The directory structure will be:
reckless/
    source/                (original plugin code here)
        plugin_entrypoint  (original entrypoint)
    plugin_name            (symlink or wrapper to activate venv)
    .metadata              (installation information)
    .venv/                 (python virtual environment)

The wrapper matches the naming of the original plugin entrypoint. The
shebang is modified to use the virtual environment's python binary,
then the original plugin is imported as a module and executed as though
it was run directly.

Changelog-Changed: reckless installs python plugins in virtual environments
2024-02-07 13:24:34 +01:00
Alex Myers 03e78ce6d9 reckless: add option to check out a specific commit
... using the syntax reckless install <plugin_name>@<commit hash>
2024-02-07 13:24:34 +01:00
Alex Myers d5ed7b7b5c reckless: add installation metadata
The metadata includes an original retrieval source, timestamp, and commit
hash.  This will allow a future update command to more easily evaluate the
status of the existing installation.
2024-02-07 13:24:34 +01:00
Alex Myers 2b502ebcbc reckless: add staging directory and symlink
This creates a separate staging directory from the one used to clone
the source.  A symlink is then added to the plugin's entrypoint which is
now in the source directory.
2024-02-07 13:24:34 +01:00
Alex Myers c043bf2255 reckless: properly remove entry from reckless sources
Fixes a bug introduced in 6163138420 which
avoided gratuitous rewrites of the lightningd config
2024-02-07 13:24:34 +01:00
Graham Krizek f5ddb89d83 Add a method to the pyln-client for using the sendcustommsg api 2024-02-07 13:17:30 +01:00
Rusty Russell f56b9e9b73 lightningd: deprecate @-prefix hack for offer recurrence_base.
Christian points out that this makes the type harder, and it's just awkward.

Changelog-EXPERIMENTAL: JSON-RPC: Deprecated `offer` parameter `recurrence_base` with `@` prefix: use `recurrence_start_any_period`.
Changelog-EXPERIMENTAL: JSON-RPC: Added `offer` parameter `recurrence_start_any_period`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-07 09:21:00 +10:30
Rusty Russell 1d0a0f6600 common: don't insist on unique param() arguments.
It can actually be useful for more complex parameter parsing, as we're about to see.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-07 09:21:00 +10:30
Sergi Delgado Segura 23bd03c62b cln-grpc: Patches rpc-file path
`cln-gprc` is assuming the `rpc-file` path is set as default, which may not always
be the case. Set the path the what the plugin manager reports
2024-02-06 14:19:39 +01:00
saisuraj27 fe09484bb9 Removed duplicate keys in some dictionaries. 2024-02-05 11:25:01 +01:00
Matt Morehouse 25b40d2ce8 fuzz: use explicit fetching for digest algorithms
For better performance it is recommended to use the modern OpenSSL
EVP_MD_fetch API to load digest algorithms (i.e. explicit fetching),
instead of the older implicit fetching API.

As a side effect, using this API seems to avoid memory leaks with some
versions of OpenSSL.
2024-02-04 17:16:01 +01:00
Matt Morehouse cfcfcb04d1 Revert "ci: Split out the fuzz testing"
This reverts commit 6bf97ac259.
2024-02-04 17:16:01 +01:00
Lagrang3 02663c5dee regtest: fix check for bitcoin-cli
Fixes startup_regtest test that checks if bitcoin-cli, bitcoind,
lightning-cli and lightningd are found as executables.
2024-02-04 16:54:53 +01:00
Rusty Russell 28c4a52aa6 pytest: another bad gossip flake
This time in renepay tests.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell f0ccfeaf64 pytest: fix YA gossip flake.
We can get bad gossip if a node processes a gossip message after we've closed:

```
_________________________________________ ERROR at teardown of test_closing_specified_destination _________________________________________
...
>           raise ValueError(str(errors))
E           ValueError:
E           Node errors:
E            - lightningd-1: had warning messages
E            - lightningd-4: had bad gossip messages
E           Global errors:
...
lightningd-1 2024-02-03T00:29:02.299Z INFO    0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199-connectd: Received WIRE_WARNING: WARNING: channel_announcement: no unspent txout 105x1x0
lightningd-1 2024-02-03T00:29:02.300Z DEBUG   0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199-connectd: peer_in WIRE_WARNING
lightningd-1 2024-02-03T00:29:02.300Z INFO    0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199-connectd: Received WIRE_WARNING: WARNING: channel_announcement: no unspent txout 103x1x0
lightningd-1 2024-02-03T00:29:02.339Z DEBUG   035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d-connectd: peer_in WIRE_WARNING
lightningd-1 2024-02-03T00:29:02.339Z INFO    035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d-connectd: Received WIRE_WARNING: WARNING: channel_announcement: no unspent txout 103x1x0
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 6a02cfccd7 gossipd: simplify gossip store API.
Instead of "new" and "load", we don't really need to "load" anything,
so do everything in gossip_store_new.

Have it do the compaction/rewrite, and collect the dying records
2024-02-04 09:24:44 +10:30
Rusty Russell c49fb2edd5 gossipd: clean up gossip_store offsets.
gossmap offsets are to the beginning of the message, whereas
the gossip_store uses the header offset.  Convert the internals
of gossip_store to use gossmap-style uniformly, even where it's
a little less convenient.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 7efa0a46a9 gossipd: clean up gossip_store routines.
We don't use the dying flag, and we can manually append the
addendum rather than having gossip_store_add present a
bizarre interface.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell f7b7cf3719 gossipd: remove routing.c and other unused functions.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell c286241ab3 gossipd: switch over to using gossmap_manage, not routing.c.
The gossip_store_load is now basically a noop, since gossmap
does that.

gossipd removes a pile of routines dealing with messages,
in favor of just handing them to gossmap_manage.

The stub gossmap_manage constructor is removed entirely.

We simplified behaviour around channel_announcements with
no channel update: we now add them to the store, and go
back to fix the timestamp later.  This changes a test,
which explicitly tests for the old behaviour.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 137b80d53e gossipd: make the query response code use gossmap_manage.
This is a bit less optimal than before, where we had an ordered map of
channels and could easily serve "channels between scids 800000x and
900000x".  We now iterate all of them.

The rest is fairly mechanical.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 70811f7ed1 gossipd: make the seeker code use gossmap_manage.
We add a temporary stub gossmap_manage constructor, which simply opens
the gossmap and doesn't do anything else.

Then seeker uses this, rather than routing.c, to probe.

We optimize our "get random node announcements" a bit by traversing a
random set of nodes directly, and seeing if we have no
node_announcement, then querying their first channel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 8f768634df gossipd: re-implement flood protection.
If we've got more than 10000 pending channel_announcements,
complain and stop processing any more.

If this becomes a problem, we can limit individual peers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 8f7f76f8c6 gossipd: don't validate UTXOs on our own channels.
It's an unnecessary round-trip, and can cause us to complain in CI, in
the case where the channel has been closed by the time we ask.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell f7ff3613c6 gossipd: interface to have gossmap_manage send updates on init.
At initialization, gossipd is supposed to send all the local
channel_updates and any node_announcement it knows, so lightningd
doesn't generate fresh ones unnecessarily.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 2ae3d25461 gossipd: implement pruning timer inside gossmap_manage.
No external interfaces, we start the timer on allocation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 2964e35699 gossipd: gossmap_manage helper to get a node's address, if any.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 1384d56db3 gossmap_manage: new file for managing the gossip store.
This is a fair amount of code, but much is taken from
the old routing.c, with the difference that this uses
common/gossmap instead of our own structures.

The interfaces are fairly clear:

1. gossmap_manage_new - allocator
2. gossmap_manage_channel_announcement
   - handle new channel announcement msg
   - if too early, keeps it in early map
   - queues it, asks lightingd about UTXO.
3. gossmap_manage_handle_get_txout_reply
   - handle response from lightningd for above.
4. gossmap_manage_channel_update
   - handle channel_update message
   - may have to wait on pending channel_announcement
5. gossmap_manage_node_announcement
   - handle node_announcement msg
   - may have to wait on pending channel_announcement
6. gossmap_manage_new_block
   - see if early announces can now be processed.
7. gossmap_manage_channel_spent
   - lightningd tells us UTXO is spent
   - may prepare channel for closing in 12 blocks.
8. gossmap_manage_channel_dying
   - gossip_store load tells us channel was spent earlier.
   - like gossmap_manage_channel_spent, but maybe < 12.
9. gossmap_manage_get_gossmap
   - gossmap accessor: seeker and queries will need this.
10. gossmap_manage_new_peer
   - a new peer has connected, give them all our gossip.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 104d6a9c78 gossip_store: remove infratructure and bits for marking ratelimited entries.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 07cd4a809b gossipd: remove spam handling.
We weakened this progressively over time, and gossip v1.5 makes spam
impossible by protocol, so we can wait until then.

Removing this code simplifies things a great deal!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: Protocol: we no longer ratelimit gossip messages by channel, making our code far simpler.
2024-02-04 09:24:44 +10:30
Rusty Russell e7ceffd565 gossipd: remove zombie handling.
We never enabled it, because we seemed to be eliminating valid
channels.  We discard zombie-marked records on loading.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell af64d30407 gossipd: move gossip_store pointer from struct routing_state to daemon.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 66574882a3 gossipd: simplify seeker startup.
Most nodes don't really care about exact timestamps on gossip filters,
so just keep a flag on whether we have anything in the gossip_store,
and use that to determine whether we ask peers for everything.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell ddc6783cf0 gossipd: move timestamp_reasonable out of routing.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 0388343602 gossipd: move dev flags from routing struct to daemon struct.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 0498695f1f gossipd: have seeker quert interfaces take an id, not a struct peer.
Again, we don't necessarily have a peer pointer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 275d59ead4 gossipd: pass node_id to queue_peer_msg, not peer.
This is easier for future callers, which don't have a convenient peer
structure: in particular, asynchronous processing of gossip for peers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 8cfbc1e7ad gossipd: make gossip_store hold daemon ptr, not rstate.
Makes it easier to wean off routing.c.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 7f5fe52320 gossipd: remove online gossip_store compaction.
It was an obscure dev command, as it never worked reliably.
It would be much easier to re-implement once this is done.

This turned out to reveal a tiny leak on
tests/test_gossip.py::test_gossip_store_load_amount_truncated where we
didn't immedately free chan_ann if it was dangling.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 561859da0c gossipd: move tell_lightningd_peer_update from routing.c into gossipd.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 2d09af8d56 gossipd: take signature checks out of routing.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell 652432a298 gossipd: take txout failure cache out of routing.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30
Rusty Russell ce39309c0c common: optional gossmap callbacks for better failure handling.
In particular, allow callers to see unknown records we ignore (and let
them fail as a result), and get called if we can't pack a
channel_update into our internal format.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-02-04 09:24:44 +10:30