Commit Graph

11305 Commits

Author SHA1 Message Date
Christian Decker 2e113607dc pyln-testing: Add `gossip_store` parser to testing framework
I had to parse quite a few of these files debugging zeroconf, so I
thought it might be nice to have direct access here.

Changelog-Added: pyln-testing: Added utilities to read and parse `gossip_store` file for nodes.
2022-06-07 13:43:28 +02:00
Christian Decker 4d1fe0d0ca fixup! zeroconf: Announce the channel with the real scid as well as aliases 2022-06-07 13:43:28 +02:00
Christian Decker 505229922e fixup! zeroconf: Announce the channel with the real scid as well as aliases 2022-06-07 13:43:28 +02:00
Christian Decker 060e6644a9 zeroconf: Announce the channel with the real scid as well as aliases
With zeroconf we have to duplicate the `local_channel_announcement`
since we locally announce the aliased version, and then on the first
confirmation we also add the funding scid version.
2022-06-07 13:43:28 +02:00
Christian Decker c921092442 channeld: Track the funding depth while awaiting lockin
We used to agree up on the `minimum_depth` with the peer, thus when
they told us that the funding locked we'd be sure we either have a
scid or we'd trigger the state transition when we do. However if we
had a scid, and we got a funding_locked we'd trust them not to have
sent it early. Now we explicitly track the depth in the channel while
waiting for the funding to confirm.

Changelog-Fixed: channeld: Enforce our own `minimum_depth` beyond just confirming
2022-06-07 13:43:28 +02:00
Christian Decker 6945844adf ld: Use the local alias when reporting failures with zeroconf
Ran into this with a zeroconf channel, without confs, that was
disconnected.
2022-06-07 13:43:28 +02:00
Christian Decker fe712c1165 channeld: Explicitly use the first commitment point on reconnect
The spec explicitly asks for the first point, while we were using the
most recent one. This worked fine before zeroconf, but with zeroconf
it can happen.
2022-06-07 13:43:28 +02:00
Christian Decker 4e2b1271f7 pytest: Add test for zeroconf channels transitioning to be public
We need to switch to the real short_channel_id at 6 confirmations, and
gossip messages should reflect that in order to be valid to others.
2022-06-07 13:43:28 +02:00
Christian Decker 9556998275 pytest: Add test for forwarding over zeroconf channels 2022-06-07 13:43:28 +02:00
Christian Decker 149c02eaeb pytest: Add a test for direct payment over zeroconf channels 2022-06-07 13:43:28 +02:00
Christian Decker 4b899c766d db: Store the local alias for forwarded incoming payments
Not only can the outgoing edge be a zeroconf channel, it can also be
the incoming channel. So we revert to the usual trick of using the
local alias if the short_channel_id isn't known yet.

We use the LOCAL alias instead of the REMOTE alias even though the
sender likely used the REMOTE alias to refer to the channel. This is
because we control the LOCAL alias, and we keep it stable during the
lifetime of the channel, whereas the REMOTE one could change or not be
there yet.
2022-06-07 13:43:28 +02:00
Christian Decker 4fb750ccbd ld: Add function to retrieve either the scid or the local alias
We use this in a couple of places, when we want to refer to a channel
by its `short_channel_id`, I'm moving this into a separate function
primarily to have a way to mark places where we do that.
2022-06-07 13:43:28 +02:00
Christian Decker 8e676e1de5 pay: Populate the channel hints with either the scid or the alias
We'll use one of the two, and we reuse the `scid` field, since we
don't really care that much which one it is.
2022-06-07 13:43:28 +02:00
Christian Decker e44e5dba82 jsonrpc: Include the direction also if we have an alias
The direction only depends on the ordering between node_ids, not the
short_channel_id, so we can include it and it won't change. This was
causing some trouble loading the `channel_hints` in the `pay` plugin.
2022-06-07 13:43:28 +02:00
Christian Decker 4893f8d4af zeroconf: Trigger coin_movement on first real confirmation
We don't trigger on depth=0 since that'd give us bogus blockheights
and pointers into the chain, instead we defer until we get a first
confirmation. This extracts some of the logic from `lockin_complete`,
into the depth change listener (not the remote funding locked since at
that point we're certainly locked in and we don't really care about
that for bookkeeping anyway).
2022-06-07 13:43:28 +02:00
Christian Decker d8568460ee db: Store the alias if that's all we got in a forward 2022-06-07 13:43:28 +02:00
Christian Decker 1f787a4a72 ld: Consider local aliases when forwarding 2022-06-07 13:43:28 +02:00
Christian Decker 7110a8a83d invoice: Consider aliases too when selecting routehints 2022-06-07 13:43:28 +02:00
Christian Decker 22009c53a3 ld: Allow lockin despite not having a scid yet
This is needed for us to transition to CHANNELD_NORMAL for zeroconf
channels, i.e., channels where we don't have a short channel ID yet.

We'll have to call lockin_complete a second time, once we learn the
real scid.
2022-06-07 13:43:28 +02:00
Christian Decker c897080304 jsonrpc: Add aliases to `listpeers` result 2022-06-07 13:43:28 +02:00
Christian Decker a7a5ec4597 gossip: Add both channel directions with their respective alias
We locally generate an update with our local alias, and get one from
the peer with the remote alias, so we need to add them both. We do so
only if using the alias in the first place though.
2022-06-07 13:43:28 +02:00
Christian Decker 5f5587ee21 gossipd: Use the remote alias if no real scid is known
This is for the local channel announcement that'll not leave this
host, as it doesn't have signatures.
2022-06-07 13:43:28 +02:00
Christian Decker 7602054789 channeld: On funding_locked, remember either alias or real scid 2022-06-07 13:43:28 +02:00
Christian Decker 069b8a1c74 channeld: Remember remote alias for channel announcements and update 2022-06-07 13:43:28 +02:00
Christian Decker 3e50d99cbc channeld: Send a depth=0 notification when channeld starts up
This is used in order to ensure zeroconf doesn't just wait for the
first confirmation despite minconf being set to 0.
2022-06-07 13:43:28 +02:00
Christian Decker a191b88ca5 zeroconf: Wire the aliases through `channeld` 2022-06-07 13:43:28 +02:00
Christian Decker ff249666cc zeroconf: Add alias_remote and alias_local to channel and DB
`alias_local` is generated locally and sent to the peer so it knows
what we're calling the channel, while `alias_remote` is received by
the peer so we know what to include in routehints when generating
invoices.
2022-06-07 13:43:28 +02:00
Christian Decker 48f8d4b698 wire: Add funding_locked tlv patch from PR lightning/bolts#910
Minimal set of changes to update the peer_wire.csv to include the TLV
field in the `funding_locked` message, and add type 1=alias from that
PR too.
2022-06-07 13:43:28 +02:00
Christian Decker 049b90dbad jsonrpc: Add option_zeroconf handling to `listpeers` 2022-06-07 13:43:28 +02:00
Christian Decker a3b0387d3e pytest: Test the `mindepth` customizations of `fundchannel` and hook
Just test that we can customize, and we'll add mindepth=0 support in
the next couple of commits.
2022-06-07 13:43:28 +02:00
Christian Decker 440f05f124 plugin: Allow plugins to customize the mindepth in accept_channel
This is the counterpart of the `mindepth` parameter in `fundchannel`
and friends. Allows dynamic lookups of `node_id` and selectively
opting into `option_zeroconf` being used.

Changelog-Added: plugin: The `openchannel` hook may return a `mindepth` indicating how many confirmations are required.
2022-06-07 13:43:28 +02:00
Christian Decker 46c2c3a8bf openingd: If we have negotiated zeroconf we use our mindepth
With `option_zeroconf` we may now send `channel_ready` at any time we
want, rendering the `mindepth` parameter a mere heads up. We ignore it
in favor of our own value, since we plan to trigger releasing the
`channel_ready` once we reach our own depth.
2022-06-07 13:43:28 +02:00
Christian Decker e99e19b383 bolt: Reflect the zeroconf featurebits in code 2022-06-07 13:43:28 +02:00
Christian Decker 3574810eb0 jsonrpc: Add `mindepth` argument to fundchannel and multifundchannel
This will eventually enable us to specify 0 for zeroconf channels.

Changelog-Added JSON-RPC: Added `minconf` argument to specify the number of confirmations we require for `fundchannel` and `multifundchannel`
2022-06-07 13:43:28 +02:00
Christian Decker 9c5c1bfac0 json: Add parser for u32 params 2022-06-07 13:43:28 +02:00
Christian Decker 74ddc15435 route: Do not require both directions to be active
This likely lead to a number of false errors when attempting to
route. We deemed a channel to be unusable as soon as either direction
isn't usable. This is bad since it excludes not only zeroconf
channels (which have different scids for the two directions), but it
also excludes any channel that we haven't seen an update from
yet. This was likely introduced when attemting to exclude nodes that
haven't sent a disable, but their peer has, but this is not necessary
as the unresponsive node would be marked as isolated by all its peers,
so we don't need to artificially mark a channel direction as disabled
when really we can't even enter the node to traverse the channel in
that direction.

Changelog-Fixed: routing: Fixed an issue where we would exclude the entire channel if either direction was disabled, or we hadn't seen an update yet.
2022-05-25 14:47:05 +09:30
Christian Decker f1d0325620 topo: Fix issue considering the wrong direction for capacity limits
Changelog-Fixed: topology: Under some circumstances we were considering the limits on the wrong direction for a channel
2022-05-25 14:47:05 +09:30
José A.P 0153621b32 Fixes #5276 by using as docker base image debian bullseye instead of buster
Changelog-Fixed: Upgrade docker base image from Debian buster to bullseye to work with glibc 2.29+ #5276
2022-05-22 14:25:05 +02:00
Rusty Russell c7d359baf4 cln-grpc: API updates after 8dd51d127f
Changing the JSON schemas changes this, and I didn't rebuild!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-19 10:00:27 +09:30
Rusty Russell abd01a1701 Makefile: update to include fix for remote_addr generation.
Now it's formatted properly, we don't need the patch.

But we need to explicitly marshal/unmarshal into a byte stream,
which involves some code rearrangement.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-19 09:47:32 +09:30
Rusty Russell 685fa25756 Makefile: update bolts to include remote_pubkey change.
Only affects comments.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-19 09:47:32 +09:30
Rusty Russell bf040c398b Makefile: update to BOLTs without zlib.
This contains a typo fix and a clarification on channel_type, but also
removes ZLIB.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-19 09:47:32 +09:30
Rusty Russell a4c365f8d0 gossipd: neaten code now we don't have to prepend prefix after.
We can simply start with a '0' where encoding is prefixed, so simplify
internal interface.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-19 09:47:32 +09:30
Rusty Russell 5735f71e3c gossipd: don't ever use zlib compression on gossip.
This was eliminated this morning in the latest spec.  We still accept them,
we just don't produce them any more.

Changelog-Removed: Protocol: We no longer create gossip messages which use zlib encoding (we still understand them, for now!)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-19 09:47:32 +09:30
Christian Decker 4cd6210c19 docker: Add rust build support to Dockerfile
We weren't building the Rust plugins in the `Dockerfile` since we were
missing the dependencies. Now we do.

Changelog-Fixed: docker: The docker images are now built with the rust plugins `cln-grpc`
2022-05-18 15:24:16 +02:00
Gregory Sanders b15cf312e8 Change lightning-rfc to bolts post repo move 2022-05-18 10:19:16 +09:30
Gregory Sanders 535fdc0690 More explanation of bolt csv regeneration 2022-05-18 10:19:16 +09:30
Vincenzo Palazzo c77eda6d64 pyln-spec: upgrade to the last bolt version
Changelog-Fixed: pyln-spec: update the bolts implementation

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-05-18 10:17:25 +09:30
Rusty Russell f078e54e98 lightningd: remove various deprecated JSON fields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Removed: JSON-RPC: removed `listtransactions` `outputs` `satoshis` field (deprecated v0.10.1)
Changelog-Removed: JSON-RPC: removed `listpeers` `channels` deprecated fields (deprecated v0.10.1)
Changelog-Removed: JSON-RPC: removed `listpeers` `channels` `closer` now omitted, rather than `null` (deprecated v0.10.1)
2022-05-18 10:15:36 +09:30
Rusty Russell 8b62e2584f connectd: remove enable-autotor-v2-mode option
Changelog-Removed: lightningd: removed `enable-autotor-v2-mode` option (deprecated v0.10.1)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-05-18 10:15:36 +09:30