1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-23 22:46:44 +01:00
Commit graph

2304 commits

Author SHA1 Message Date
Bastien Teinturier
de1ac34d46
Add explicit duration to ExcludeChannel (#2368)
This lets callers override the default duration or ban channels for
unlimited durations (until they send a `ListChannelExclusion`).
2022-08-10 13:26:19 +02:00
Bastien Teinturier
0310bf5dc4
Implement first steps of the dual funding flow (#2247)
We implement the first step of the dual funding protocol: exchanging
`open_channel2` and `accept_channel2`.

We currently stop after exchanging these two messages. Future commits will
add the interactive-tx protocol used to build the funding transaction.
2022-08-09 17:13:16 +02:00
Pierre-Marie Padiou
f49eb0effe
Update sqlite to 3.39.2.0 (#2369)
This should fix an intermittent segfault, see:
- https://github.com/ACINQ/eclair/runs/7741716877
- https://github.com/xerial/sqlite-jdbc/issues/680
2022-08-09 14:31:03 +02:00
Pierre-Marie Padiou
9f9cf9ce0e
(Minor) Test improvements (#2354)
Note on log capture:
- akka version (`... with LogCapturing`): only works when tests are run sequentially (that is: useless on CI), otherwise outputs of all test are mixed together
- my version: separate between tests, but ugly formatting, because akka's `StdOutLogger` dosen't use logback settings.
2022-08-09 14:30:45 +02:00
Bastien Teinturier
c71c3b4046
Make htlc_maximum_msat mandatory in channel updates (#2361)
The specification is removing support for old channel updates that didn't
include an `htlc_maximum_msat` (https://github.com/lightning/bolts/pull/996).

Every implementation has been generating updates containing this field for
years, so we can safely reject updates that don't contain it.
2022-08-08 15:05:38 +02:00
Bastien Teinturier
85fea72720
Broadcast commit tx when nothing at stake (#2360)
When we have nothing at stake (channel was never used and we don't have
funds to claim), we previously directly went to the CLOSED state without
publishing our commitment. This can be an issue for our peer if they have
lost data or had a hard time getting a funding tx confirmed.

We now publish our commitment once to help them get their funds back in
all cases and avoid the CSV delays when getting their funds back.

Fixes #1730
2022-08-03 18:03:20 +02:00
Thomas HUET
8a42246b18
Update offers types (#2351)
Most notable changes:
- the node id is now 33 bytes like everywhere else
- blinded paths are mandatory in invoices
2022-07-27 10:44:21 +02:00
Bastien Teinturier
b171a1690f
Remove payments overview DB (#2357)
We introduced a way to get a "light" payments view in #1225.
This was a performance improvement for mobile wallets embedding eclair.

Mobile wallets should now use lightning-kmp instead of eclair, so we can
get rid of that unused code.
2022-07-26 15:16:20 +02:00
DerEwige
4fd3d90961
Emit event when receiving Pong (#2355)
This event can be useful to let plugins track the latency
of peer connections.
2022-07-26 14:52:16 +02:00
Thomas HUET
99d9bc181c
Relay blinded payments (#2253)
Allow relaying blinded payments (lightning/bolts#765)
2022-07-26 14:45:47 +02:00
Pierre-Marie Padiou
23de6c4efd
Fix flaky zeroconf test (#2352)
The flaky test was `ZeroConfAliasIntegrationSpec`.`a->b->c (b-c private)`.

Due to a race between node watchers, we were sometimes entering into
this scenario between bob and carol:

1) carol's watcher wins the race and sends her `channel_ready` to bob
  before bob has received `WatchFundingConfirmedTriggered` from his own
  watcher
2) the channel isn't officially zeroconf, but bob gladly accepts carol's
  early `channel_ready` and moves directly to `WAIT_FOR_CHANNEL_READY` and
  then `NORMAL`, *without a real scid*.
3) bob ignores the `WatchFundingConfirmedTriggered` that it receives in
  state `WAIT_FOR_CHANNEL_READY` or `NORMAL`
4) bob later receives the `WatchFundingDeeplyBuriedTriggered`, discovers
  his own real scid and emits a `ShortChannelIdAssigned` event, but the
  channel relayer only listens to `LocalChannelUpdate`.
5) subsequent a->b->c payment using a real scid for b-c as routing hint
  fails because b's relayer doesn't know it.

There are two ways of fixing this:

a) make the relayer listen to `ShortChannelIdAssigned` (like it did before)
b) emit a `LocalChannelUpdate` event containing the new real scid and
  the same `channel_update`.

In this commit, we chose to implement (b).

Co-authored-by: t-bast <bastuc@hotmail.fr>
2022-07-26 14:40:42 +02:00
Thomas HUET
214873e4a7
Use the correct extra edges to put in metrics (#2350)
We were using hints from `SendPaymentConfig.invoice` to populate `PathFindingExperimentMetrics`, but the invoice is optional and not populated for trampoline relay.
2022-07-22 16:06:41 +02:00
Thomas HUET
c20b3c9e8b
Remove redundant routing hint (#2349)
In `SendPaymentToNode`, the routing hints were present twice: once in `invoice` and once in `extraEdges`. I'm only keeping `invoice`.
Also make the `ExtraEdge` trait use `def` as there may be problems with `val`.
2022-07-22 14:16:25 +02:00
Barry G Becker
e1dc358c79
Fix RoutingHeuristics.normalize (#2331)
`RoutingHeuristics.normalize` could return 1, it now returns a value in (0, 1)
2022-07-04 14:05:12 +02:00
Pierre-Marie Padiou
31964620bd
Proper json serializer for BlockHeight (#2340)
It currently serializes to `{}`.
2022-07-01 17:46:54 +02:00
Goutam Verma
276340d1b3
Add host metrics grafana dashboard (#2334)
Add a grafana dashboard to monitor host metrics
(CPU, memory, network usage, etc).
2022-07-01 17:32:46 +02:00
Bastien Teinturier
3b97e446aa
Allow disabling no-htlc commitment fee-bump (#2246)
When a channel force-close without any pending htlcs, funds are not at
risk. We want to eventually get our main output back, but if we are not
in a rush we can save on fees by never spending the anchors.

This is disabled by default as there is a potential risk: if the commit
tx doesn't confirm and the feerate rises, the commit tx may eventually be
below the network's min-relay-fee and won't confirm (at least until package
relay is available).
2022-07-01 16:04:41 +02:00
Pierre-Marie Padiou
2461ef08cb
Call resolve() on configuration (#2339)
From lightbend's config doc:

> A given Config must be resolved before using it to retrieve config values, but ideally should be resolved one time for your entire stack of fallbacks (see withFallback)

4458ea947a/config/src/main/java/com/typesafe/config/Config.java (L204-L206)
2022-07-01 15:36:30 +02:00
Bastien Teinturier
2790b2ff6c
Activate 0-conf based on per-peer feature override (#2329)
We restrict 0-conf activation on a per-peer basis. When 0-conf is activated
by both peers, we use it even if it wasn't part of the `channel_type`.
2022-07-01 15:13:57 +02:00
Bastien Teinturier
a1f7c1e74f
Return local channel alias in payment failures (#2323)
We now use either our local alias or the real scid in the channel update
that we store internally. When we send that channel update directly to
our peer, we override it to use the remote alias when it makes sense.
2022-07-01 15:13:26 +02:00
Bastien Teinturier
6011c867cf
Additive per-node feature override (#2328)
The `override-init-features` field in `eclair.conf` was not previously
applied on top of the `features` field, so node operators were usually
copy-pasting their `features` overrides in every `override-init-features`.

The overrides are now applied on top of the base `features` configuration,
which makes it easier and more intuitive to configure per-node features.
2022-07-01 14:33:14 +02:00
Pierre-Marie Padiou
8af14ac515
Backport from feature branches (#2326)
* improve bitcoin client metrics

* only use batching bitcoin client for the watcher

* use named args for defaultFromFeatures method

* use default min_depth in edge case scenario

* add OutgoingChannelParams trait

* update amounts in ChannelRelayerSpec

* make register take typed replyTo

* improve codecs non-reg tests
2022-06-29 16:11:05 +02:00
Thomas HUET
e880b62c13
Refactor routing hints to prepare for payments to blinded routes (#2315)
Bolt11 uses routing hints to add extra edges for the path-finding, blinded routes are also extra edges added to the path-finding but they have a different format. The new type `ExtraEdge` is more flexible and can be expanded to cover new kinds of extra edges such as blinded routes.
2022-06-29 16:08:37 +02:00
Pierre-Marie Padiou
c9810d5424
Resume reading after processing unknown messages (#2332)
If the current chunk of data read from the TCP connection only contains unknown messages (in particular, could be only one isolated unknown message on an otherwise idle connection), we never resumed reading on the connection.

This means all subsequent messages, including pings/pongs, won't be read, which is why the most visible effect is disconnecting due to no response to ping.

Related to https://github.com/ElementsProject/lightning/pull/5347.

Reported by @wtogami.
2022-06-29 15:12:04 +02:00
Pierre-Marie Padiou
08d2ad4a91
Random values for generateLocalAlias() (#2337)
We generate alias randomly, and use a value space large enough to not have to worry about duplicates.
2022-06-29 13:22:15 +02:00
Fabrice Drouin
af79f44051
Move arm64 docker file to contrib and udpate README.md (#2327) 2022-06-23 16:11:21 +02:00
Chris Guida
0c84063d32
add arm64v8 Dockerfile (#2304)
Add arm64v8 Dockerfile
2022-06-23 14:23:26 +02:00
Pierre-Marie Padiou
70de271312
Make actors signal when they are ready (#2322)
Since actors are initialized asynchronously, and the initialization sometimes involves subscribing to an `EventStream`, we don't know when they are ready to process messages, especially in tests, which lead to race conditions. By making actors publish `SubscriptionsComplete ` on the same `EventStream` they are subscribing to, we guarantee that if we receive `SubscriptionsComplete ` the actor has been initialized and its subscriptions have been taken into account.
2022-06-23 10:49:13 +02:00
Goutam Verma
6b2e415ecb
Expose scraping endpoint for prometheus metrics (#2321)
Allow eclair to expose a metrics scraping endpoint for Prometheus
for users who don't want to rely on Kamon's hosted infrastructure. 

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2022-06-16 17:52:57 +02:00
Pierre-Marie Padiou
26741fabca
Reuse postgres instance in tests (#2313)
Create new database for each unit test instead of spawning a new db
instance.

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2022-06-16 17:50:16 +02:00
Bastien Teinturier
fc30eab0a0
Remove channelId from PublicChannel (#2324)
We can currently deduce the `channel_id` of a public channel because it
is based on the funding transaction coordinates, but that won't be the
case with dual-funding, where the `channel_id` will be private information
between the two channel peers.
2022-06-16 17:32:19 +02:00
Bastien Teinturier
6882bc9b2f
Clean up scid parsing from coordinates string (#2320)
We make it explicit that conversion from a string to an scid uses the tx
coordinates and can fail.

We also clean up compiler warnings in updated test files.
2022-06-16 13:04:21 +02:00
Pierre-Marie Padiou
7630c5169c
(Minor) Fix flaky ZeroConfAliasIntegrationSpec (#2319)
This build failure: https://github.com/ACINQ/eclair/runs/6901214111 was possibly caused by the register not yet having been notified of the real scid.
2022-06-16 10:44:23 +02:00
Pierre-Marie Padiou
bfba9e4119
(Minor) Include the discriminator in all channel codecs (#2317)
So we don't need to rename them when a new codec is added.
2022-06-16 10:38:58 +02:00
Bastien Teinturier
f47c7c39fa
Don't block when generating shutdown script (#2284)
We were previously using a blocking call, which can create issues on
failures and timeouts.
2022-06-15 14:25:35 +02:00
Pierre-Marie Padiou
e5f5cd152e
Add support for zero-conf and scid-alias (#2224)
This implements lightning/bolts#910.

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2022-06-15 13:09:54 +02:00
Barry G Becker
e8c9df4ec4
Add more GraphSpec tests (#2292) (#2293)
Add test for the wikipedia example of Yen's algorithm
2022-06-13 10:59:50 +02:00
llya Evdokimov
3e3f786000
Allow disabling bitcoind requests batching (#2301)
Eclair batches bitcoind request by default for efficiency.
However this can create latency and reliability issues when
running bitcoind on a remote machine over an unreliable
network. In those cases it's better to opt-out of batching.

We also make the threshold of missing blocks for blockchain
watchdog configurable instead of a hard-coded value of 6.
2022-06-13 08:35:19 +02:00
Bastien Teinturier
c4786f3a7b
Store disabled channel update when offline (#2307)
When a channel is offline and we want to relay an HTLC through it, we emit
a new `channel_update` with the disable bit set (unless it was already
disabled).

We previously didn't persist our internal state with this new
`channel_update`, which created the following issue: if eclair is restarted
before the channel comes back online, eclair would only try to rebroadcast
the previous `channel_update` which has a lower timestamp than the one
disabling the channel. That `channel_update` is then rejected by the
network, causing the channel to stay disabled until the next refresh,
which only happens after 10 days.
2022-06-08 16:33:59 +02:00
Thomas HUET
472275573c
Estimate balances of remote channels (#2272)
We use past payments attempts to estimate the balances of all channels. This can later be used in path-finding to improve the reliability of payments.
2022-06-08 13:37:19 +02:00
Bastien Teinturier
682e9bf6a7
Fix minimal node fixture flakyness (#2302)
There was a race condition between the `wait_for_funding_locked` state
and the `normal` state.
2022-06-08 13:33:55 +02:00
Pierre-Marie Padiou
340b568d53
(Minor) Test nits (#2306)
* use zero-args method to skip fixture

This is the proper way to skip building the fixture. Using `_` actually
creates a fixture and then ignores it.

* consistency nit

* use list/map instead for test cases

* add a custom reporter to highlight slowest tests
2022-06-08 13:03:33 +02:00
Thomas HUET
c5620b2d56
Log routing hint when finding a route (#2242)
When finding a payment route (typically for routing a trampoline payment) we already log the recipient node id, however it can be a private node hidden behind a routing hint in which case it is more useful to log the public node from the routing hint.
This is added to the `audit.path_finding_metrics` and we also add the `payment_hash` so that it can be joined with the `audit.relayed` and `audit.relayed_trampoline` tables.
2022-06-08 11:08:30 +02:00
Pierre-Marie Padiou
e08353b243
Remove close() in db interfaces (#2303)
* Remove close() in db interfaces

It shouldn't be the responsibility of individual db classes to close
the underlying db connection because they typically share the same db
instance (postgres) or db files (sqlite). Closing should be handled in
the `Databases` level (which is already the case for postgres.

For sqlite, closing was only useful for mobile apps, which now use
lightning-kmp.

Also removed `DbFeeProvider`, which was only used by mobile apps.

* increase github ci build time 20min->30min
2022-06-08 10:39:21 +02:00
Bastien Teinturier
ecbec93dfe
Add traits for permanent channel features (#2282)
We create new feature traits for permanent channel features, split between
features that are part of the channel type and features that are not.
2022-06-06 13:51:44 +02:00
rorp
47c5b95eaa
Drop support for Tor v2 hidden services (#2296)
Tor v2 addresses have been officially deprecated by the
Tor team and removed from the lightning specification in
https://github.com/lightning/bolts/pull/940
2022-06-06 10:03:44 +02:00
Pierre-Marie Padiou
9610fe30e3
Define a proper base class for fixture tests (#2286)
This PR does two main things:
- introduce a new `FixtureSpec` base class for tests that involve a fixture. See the scaladoc for more info. 
- add new simple integration tests in package `integration.basic`. They are based on `MinimalNodeFixture`, which is a full setup for a node with real actors, except the bitcoin part (watcher/wallet) which is mocked. They are much lighter than our previous integration tests, which allow us to keep each test individual, as opposed to having all tests of the same suite depend on each other. We can define more complex fixtures with any number of nodes.

Other minor improvements:
- update scalatest version
- simplify `ChannelStateTestsHelperMethods`
- replace all === by ==

Triple equals allows customizing the equality method, but we never use
that.

Detailed errors (which is what we were looking for) are provided by
mixing in scalatest's `Assertions` and using the regular `assert(x==y)`
syntax. The `Assertions` trait is already mixed in by default in all
scalatest suites.
2022-06-03 09:58:53 +02:00
Bastien Teinturier
ee46c56281
Remove dependency between dual funding and anchors (#2297)
This dependency didn't actually make sense, and we're removing it from
the spec as well.
2022-06-01 21:58:42 +02:00
Bastien Teinturier
088de6f666
Don't RBF anchor if commit is confirmed (#2283)
Even though we use our anchor to CPFP our commit tx, the commit tx could
confirm on its own. If that happens, we don't care about the anchor tx so
we shouldn't RBF it. Ideally we'd like to cancel it but that's impossible,
so we just wait for it to either confirm or drop out of mempools after a
while.
2022-06-01 19:21:28 +02:00
Bastien Teinturier
749d92ba39
Add option to disable sending remote addr in init (#2285)
When running behind a load balancer that doesn't preserve the client source
IP address, it doesn't make sense to include the `remote-address` tlv in
our `init` message, it will contain an IP address that is completely
unrelated to our peer.

Fixes #2256
2022-05-31 17:20:59 +02:00