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

2645 commits

Author SHA1 Message Date
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
Barry G Becker
45f19f6287
Fix test when run in Intellij (#2288) (#2289)
The path needed to be adjusted from "target" to "eclair-core/target".
Also fixed a typo in a comment.
2022-05-30 16:50:03 +02:00
Pierre-Marie Padiou
9c7ddcd874
Increase closed timeout from 10s to 1min (#2281)
This gives more time to rollback the funding tx in case where we moved
from `WAIT_FOR_FUNDING_INTERNAL`->`CLOSED`.

We could do it differently, with an additional step, or by only sending
the "shutdown" symbol after we receive the wallet response for this
specific transition, but it would be more complicated.
2022-05-24 10:09:25 +02:00
Pierre-Marie Padiou
44e71277a6
(Minor) Postgres: use write instead of writePretty (#2279)
There is no point in formatting the json since the `JSONB` data type
that we use in postgres do not preserve formatting.
2022-05-20 15:01:35 +02:00
Pierre-Marie Padiou
d98da6f44f
Index unannounced channels on channelId instead of shortChannelId in the router (#2269)
This is the final preparatory step before we can introduce channel aliases, which are arbitrary values of type `ShortChannelId`. We had to move to a stable identifier for private channels. Public channels can keep using the `shortChannelId`, it is stable because it is a "real scid" (and only used after 6 confs) and is useful as an index for channel queries.
2022-05-19 13:31:27 +02:00
Pierre-Marie Padiou
6fa02a0ec1
Use long id instead of short id in ChannelRelay (#2221)
This is a preparation for https://github.com/lightning/bolts/pull/910.

The relaying logic is now based on the `channelId` instead of
`shortChannelId`.

We used to consider `shortChannelId` as a unique identifier for the
channel, but it's not true anymore: there will be multiple aliases per
channel.
2022-05-19 10:55:47 +02:00
Bastien Teinturier
1e8791c56e
Update dual funding codecs (#2245)
* Use u16 instead of varint for lengths
* Revert channel flags extension
* Remove support for non-native segwit inputs
2022-05-19 10:40:03 +02:00
Bastien Teinturier
03097b0d42
Add localChannelReserve and remoteChannelReserve (#2237)
This is easier to use than having to decide which params we should look
into (local or remote). It will also be easier to integrate with dual funding.

Rename initialFeeratePerKw: this name was very confusing.
This feerate only applies to the commit tx, so we make that explicit.
2022-05-19 09:43:08 +02:00
Pierre-Marie Padiou
bb7703aa5d
Add simple integration test between Channel and Router (#2270)
In this PR we add a basic integration test between `Channel` and `Router` that checks the proper handling of local announcements.

* disable router rebroadcast in tests

* use separate ActorSystem for alice and bob in tests

* add a simple channel-router integration test

* fix bug found in new channel-router test

The new test was failing, due to a bug. When a local
channel graduates from private to public, we do not copy existing
known `channel_update`s. Current implementation guarantees that we
will process our local `channel_update` immediately, but what about our
peer?

* fix rebroadcast for local announcements

We fix a second bug where gossip origin wasn't properly set for local
announcements

* increase ram for tests to 2G

* improve debuggability of integration tests
2022-05-19 09:39:58 +02:00
Thomas HUET
81571b95e6
Fix flaky test PeerConnectionSpec (#2277)
In tests we can sleep for at least X seconds but because of other tests running in parallel, we can't get an upper bound on the sleeping time. This makes some tests that depend on time unfeasible.

Fixes #2175 #2276
2022-05-18 16:47:31 +02:00