1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-19 09:54:02 +01:00
Commit Graph

2097 Commits

Author SHA1 Message Date
Bastien Teinturier
6817d6f26e
Eclair v0.6.2 release (#1992) 2021-10-08 09:21:34 +02:00
Bastien Teinturier
75eafd0e4d
Configure dust in flight threshold (#1985)
Add config fields for max dust htlc exposure.
These configuration fields let node operators decide on the amount of dust
htlcs that can be in-flight in each channel.

In case the channel is force-closed, up to this amount may be lost in
miner fees.

When sending and receiving htlcs, we check whether they would overflow
our configured dust exposure, and fail them instantly if they do.

A large `update_fee` may overflow our dust exposure by removing from the
commit tx htlcs that were previously untrimmed.

Node operators can choose to automatically force-close when that happens,
to avoid risking losing large dust amounts to miner fees.
2021-10-08 08:35:55 +02:00
Bastien Teinturier
bb5e6df186
Fix remote upfront script codec (#1991)
The script wasn't length-delimited.
Fortunately this feature was disabled by default.
Since no-one reported the issue, we can probably just do this simple fix.
2021-10-06 14:59:42 +02:00
Bastien Teinturier
0621ccfe0c
Fix ZmqWatcher block timeout (#1989)
Unfortunately, `context.log` is *not* thread safe and shouldn't be used
in future continuation. We should instead use `pipeToSelf` when we want
to act on the results of a `Future`.
2021-10-05 19:14:57 +02:00
Bastien Teinturier
d6b46aed4d
Update anchor outputs feerate tolerance (#1980)
Allow any feerate when using anchor outputs and we're fundee.
This will prevent unwanted channel closure.

This can be unsafe in a high fee environment if the commit tx is below
the propagation threshold. However, even when we discover it it's too late
anyway, so our only option is to wait for package relay to save the day.

Ensure feerate is always above propagation threshold when we're funder.
We lift the limit configured by the node operator when it is below the
network propagation threshold.
2021-10-04 17:28:08 +02:00
Bastien Teinturier
c803da670c
Store published txs in AuditDb (#1976)
We previously computed the on-chain fees paid by us after the fact, when
receiving a notification that a transaction was confirmed. This worked
because lightning transactions had a single input, which we stored in
our DB to allow us to compute the fee.

With anchor outputs, this mechanism doesn't work anymore. Some txs have
their fees paid by a child tx, and may have more than one input.

We completely change our model to store every transaction we publish,
along with the fee we're paying for this transaction. We then separately
store every transaction that confirms, which lets us join these two data
sets to compute how much on-chain fees we paid.

This has the added benefit that we can now audit every transaction that
we tried to publish, which lets node operators audit the anchor outputs
internal RBF mechanism and all the on-chain footprint of a given channel.
2021-10-04 16:06:17 +02:00
Bastien Teinturier
d0be2cf6e1
Log payment failure summary (#1966)
It's quite cumbersome to investigate complex MPP payment failures.
We need to grep on the parent ID, then group together logs for each child
payment, and then we're ready for some analysis.

Most of the time, a quick look at the breakdown of all intermediate failures
is all we need to diagnose the problem. This PR adds such a log line.
2021-10-04 15:10:12 +02:00
Pierre-Marie Padiou
73744ee440
Move path-finding examples to documentation (#1983)
Having basic documentation in-place by providing examples in
`eclair.conf` is great and very convenient, but in the case of
path-finding, defining experiments take so much space that it makes
the whole configuration file actually more complicated to understand.
And since we don't want to enable experiments by default, the user still
has to figure out what to change to actually enable AB-testing.

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-10-04 10:29:27 +02:00
Pierre-Marie Padiou
3295881e48
Json serializers refactoring (#1979)
* make custom serializers objects instead of classes

* reorder json format definition

* use minimal serializers

Having custom serializers depend on external format would introduce an
infinite recursion at runtime if not careful. Thankfully, none of our
serializers use it, so we may as well remove the possibility entirely.

* simplify serializers further

We don't need to type the serializers: this is required for deserializing,
not serializing, and we are not using it.

The fact that be had a type mismatch here shows it:
```scala
object TransactionSerializer extends MinimalSerializer[TransactionWithInputInfo]
```

* new generic json serializer

Instead of providing a `MyClass => JValue` conversion method, we
provide a `MyClass => MyClassJson` method, with the assumption that
`MyClassJson` is serializable using the base serializers.

The rationale is that it's easier to define the structure with types
rather than by building json objects.

This also means that the serialization of attributes of class C is out
of the scope when defining the serializer for class C. See for example
how `DirectedHtlcSerializer` doesn't need anymore to bring in
lower level serializers.

It also has the advantage of removing recursion from custom serializers
which sometimes generated weird stack overflows.
2021-10-04 10:13:08 +02:00
Bastien Teinturier
fd565040d3
Remove the GUI (#1981)
So long old friend, and thanks for all the demos!
2021-10-01 14:46:27 +02:00
Pierre-Marie Padiou
97393b13b4
Fix race condition in 'stream updates to front' test (#1978)
As usual, the race condition is due to a delay before subscribing to the event stream.
2021-09-30 18:02:30 +02:00
thomash-acinq
6dc836daa3
Ignore channels without capacity (#1975)
Channels with 0 capacity shouldn't exist. But if it happens somehow we should ignore them, not pretend that they are big channels.
2021-09-30 16:10:32 +02:00
Bastien Teinturier
5fc980c8d9
Lower minimum remote dust limit (#1900)
We are slowly dropping support for non-segwit outputs, as proposed in
https://github.com/lightningnetwork/lightning-rfc/pull/894

We can thus safely allow dust limits all the way down to 354 satoshis.

In very rare cases where dust_limit_satoshis is negotiated to a low value,
our peer may generate closing txs that will not correctly relay on the
bitcoin network due to dust relay policies.

When that happens, we detect it and force-close instead of completing the
mutual close flow.
2021-09-29 14:06:20 +02:00
Dave Scotese
d5c0c73921
Clarify Bitcoin Core supported versions (#1960)
Installation instructions make it clear that only the versions of Bitcoin Core
listed are actively tested with eclair.
2021-09-29 08:49:03 +02:00
thomash-acinq
467a0bc829
Count local fees in path finding metrics (#1963)
The fee that's recorded in the path-finding metrics should count the local channel. Without it we record failing payments with a fee budget larger than the fee recorded for the successful payment to the same node.
2021-09-27 17:51:41 +02:00
Pierre-Marie Padiou
5686ad013c
Minor changes and refactoring (#1965)
* optionally record path-funding metrics

This is useful in feature branches.

Also rename `recordMetrics` to `recordPathFindingMetrics`.

* rename channel features attribute

It was a remainder of init features, which can be activated or not. But
in the context of the `ChannelFeatures` object, that naming was
confusing because all features are activated in that context.

* minor refactoring on channel_type

Moved some logic outside `Peer`.

* refactor `RouteParams`

`PathFindingConf` and `RouteParams` have almost the same set of params,
but some of them don't have the same structure (flat vs hierarchical).
2021-09-23 17:40:20 +02:00
rorp
c846781192
Make Tor optional for blockchain watchdogs (#1958)
This change lets node operators disable the use of
Tor for blockchain watchdogs if they'd rather use
cleartext HTTP instead.
2021-09-22 09:18:58 +02:00
thomash-acinq
273fae9135
Add success probabilities in path finding (#1942)
Add an alternative heuristic for path finding that combines the relay fees with virtual fees for hops, funds locked and failed payments.
2021-09-20 18:48:53 +02:00
Bastien Teinturier
8b29edb58d
Add release notes in the repository (#1951)
It's useful to have the release notes directly inside the repository
instead of relying on Github: that lets for example users read them offline.

It also lets us fill the release notes every time we add relevant features
on `master` instead of having to do them all at once when we decide to make
a release.
2021-09-20 14:35:00 +02:00
Bastien Teinturier
e93110b254
Use Github discussions instead of Gitter (#1954)
Remove references to Gitter, so that newcomers use Github discussions
instead.
2021-09-20 09:03:16 +02:00
Bastien Teinturier
5b7a474b6a
Clean up inconsistency between bitcoin client and wallet (#1939)
The separation between `ExtendedBitcoinClient` and `BitcoinCoreWallet` has
become very blurry since anchor ouputs: eclair now requires fee bumping
utilities from the underlying bitcoin wallet, and it's not yet clear what
the interface should be. The on-chain utility methods that were added to
the eclair API also made it awkward to cleanly separate concerns.

We completely remove the `BitcoinCoreWallet` and merge it inside the
bitcoin client. We may in the future re-introduce a cleaner on-chain wallet
abstraction, but that can only happen once we have stable fee bumping
mechanisms.
2021-09-15 18:20:25 +02:00
Bastien Teinturier
fb0199c069
Update Bolt 11 official test vectors (#1870)
Add payment secrets (see https://github.com/lightningnetwork/lightning-rfc/pull/887)
Add feature bits (see https://github.com/lightningnetwork/lightning-rfc/pull/898)
2021-09-14 10:02:01 +02:00
rorp
03ac320f21
Add 'shortChannelId' output format for findroute* API calls (#1943)
Add new --format parameter to the findRoute* API calls.
This lets the caller decide whether they want to receive
a list of nodeIds or shortChannelIds to identify the route.

Co-authored-by: Pierre-Marie Padiou <pm47@users.noreply.github.com>
2021-09-13 09:04:45 +02:00
Bastien Teinturier
a228baca71
Implement anchor outputs zero fee htlc txs (#1932)
Add support for https://github.com/lightningnetwork/lightning-rfc/pull/824

When the channel type is anchor outputs with zero fee htlc txs, we set
the fees for the htlc txs to 0.

An important side-effect is that it changes the trimmed to dust calculation,
and outputs that were previously dust can now be included in the commit tx.
2021-09-10 09:40:22 +02:00
Pierre-Marie Padiou
24dd6136f7
Fix the build (#1945)
* disable pg lock auto-release in tests

It relies on akka's coordinated shutdown and causes the test jvm to
halt.

* fixup! Remove  `messageFlags` from `ChannelUpdate` (#1941)
2021-09-09 17:35:03 +02:00
thomash-acinq
64f33bada4
Fix isNode1 in tests (#1944) 2021-09-09 15:45:45 +02:00
thomash-acinq
768a74558f
AB testing (#1930)
Add AB testing framework:
- Experiments are added by adding a section in router.path-finding config. Each experiment can have different parameters.
- Traffic is randomly split among the different experiments. The size of each experiment is configurable. 0% experiments don't affect traffic but can be triggered manually with the API.
- Metrics are recorded in the audit database
2021-09-09 14:17:37 +02:00
Pierre-Marie Padiou
6c546f06c0
Remove messageFlags from ChannelUpdate (#1941)
We make it a serialization detail, which it should be. The `derive`
method from `scodec` makes it very easy to do. We should probably always
use a dedicated class to handle flags, instead of using the `byte` codec
and binary operators.

This allows to remove the `require` in the `ChannelUpdate` definition,
which recently bit us in testing.

The only annoying thing is that we still need to expose a `messageFlags`
method in order to populate the `ChannelDisabled` error message.

We also typeify channel flags, as an alternative to passing around a `Byte`.
2021-09-09 13:25:25 +02:00
rorp
88f0dfd225
Make publising of onion addresses configurable (#1936)
When using Tor, your onion address is by default added to your
list of public addresses and advertised through the gossip layer
to allow peers to find your node and connect to it.

We now allow opting out of that mechanism by setting
`tor.publish-onion-address = false` in your `eclair.conf`.

This will ensure your onion address is not advertised, and peers
will not be able to connect to you unless you've connected to
them first.
2021-09-08 15:11:17 +02:00
Anton Kumaigorodski
632d40c270
Add AbstractChannelRestored event trait (#1927)
This lets plugins define variants of the `ChannelRestored` when
using non-standard channel types, while ensuring these channels
are correctly integrated in the list of local channels for payment
relaying.
2021-09-08 14:40:40 +02:00
Bastien Teinturier
663094e0bf
More flexible mutual close fees (#1768)
Add `closing_signed` `fee_range` TLV as described in
https://github.com/lightningnetwork/lightning-rfc/pull/847
We also refactor the negotiating state, add many tests and fix #1742.

Add new fields to the `close` API to let users configure their preferred
fees for mutual close.
2021-09-08 10:03:05 +02:00
Pierre-Marie Padiou
daace535c4
Dedicated event for channel_update modifications (#1935)
Use an event `ChannelUpdateParametersChanged` for the sole purpose of tracking changes to channel_update.

Also, conf change at restore is now treated like a regular fee update. We do handle `CMD_UPDATE_RELAY_FEES` in both `OFFLINE` and `SYNCING`, because there may be a race between `CMD_UPDATE_RELAY_FEES` and
`ChannelRestablish`. And there was no good reason to behave differently in those states anyway.

* fix updateRelayFee api call

The `Register` should be used to channel actors, not the `Router`.
The former tracks all channels, whereas the latter only contains
channels in certain states. We only query the `Router` when we need
reference to external (public) nodes and channels.
2021-09-03 18:45:05 +02:00
Pierre-Marie Padiou
9f9f10e911
Conversion nits (#1937) 2021-09-03 14:36:49 +02:00
Bastien Teinturier
4f93734fe3
Add warning about GUI deprecation (#1929)
The GUI has been deprecated a long time ago, and doesn't inform users about
potential risks, such as RBF-ing funding txs.

We should instead incentivize users to use the CLI and read the documentation,
which ensures they will know about potential pitfalls.
2021-09-03 14:11:48 +02:00
Pierre-Marie Padiou
118285f4a0
Gracefully release Postgres lock on shutdown (#1912)
This allows instant restart of eclair when using Postgres backend.

Fixes #1896.
2021-09-03 11:34:16 +02:00
Anton Kumaigorodski
d11765cfda
Add description_hash in createinvoice (#1919)
Bolt11 invoices can either contain a string description or a hash
of that description (if it's too big or should stay private).

The API didn't let users provide a description hash, which is now
possible.

Co-authored-by: Pierre-Marie Padiou <pm47@users.noreply.github.com>
2021-09-03 09:26:50 +02:00
rorp
bca2a83218
Tor support for blockchain watchdogs (#1907)
We now query blockchain watchdogs over Tor when it's activated.
Some watchdogs are automatically disabled because they have no
support for Tor.

We also let users change the list of watchdogs that should be run
from their `eclair.conf`.

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-09-01 09:09:10 +02:00
Pierre-Marie Padiou
54fa208c7d
Add validation on the recid in verifymessage (#1928)
We offset the `recid` by `31` for compatibility with `lnd` [1] but we
should also support normal values (0-3), and also add boundary checks.

[1] https://twitter.com/rusty_twit/status/1182102005914800128
2021-08-31 15:28:40 +02:00
Bastien Teinturier
59ccf3427a
Explicit channel type in channel open (#1867)
Add support for https://github.com/lightningnetwork/lightning-rfc/pull/880

This lets node operators open a channel with different features than what
the implicit choice based on activated features would use.
2021-08-31 09:01:06 +02:00
thomash-acinq
275581df96
Make route params explicit (#1923)
For path finding we always need `routeParams`, however all of the messages asking for finding a route have `routeParams` as an optional parameter. This makes it hard to enforce that a given payments uses a given `routeParams` as there may be a `None` somewhere that reverts to the global defaults.
It seems that the reason all the `routeParams` are optional is that the messages asking for finding a route are sometimes used when we already have a route. This is a hacky solution and I've tried to replace these messages by traits that work both when we want to find a route and when we already have it.
I'm trying to enable AB testing which requires using different `routeParams` for different payments and this is a blocker.
2021-08-30 18:12:21 +02:00
Bastien Teinturier
d53f57fed9
Switch ZMQ to block hash and improve resiliency (#1910)
* Disable ZMQ high watermark

This should prevent messages from being dropped.
We also configure the socket before subscribing to topics and connecting.

* Switch ZMQ raw block to block hash only

We were receiving raw blocks on the ZMQ socket, whereas we don't use it.
We only use this event as a trigger that a new block has been found, so we
can save bandwidth by switching to block hash subscriptions instead.

* Regularly check blocks

In case we haven't received block events on the ZMQ socket, we regularly
check whether we're behind.
2021-08-30 18:08:22 +02:00
Bastien Teinturier
92091a1504
Fix ZmqWatcher flaky test (#1925)
There's a very annoying race condition in that test, and we can end up
emitting events twice on slow machines. This isn't an issue so we stop
verifying that we avoid duplicate events.
2021-08-30 16:38:04 +02:00
thomash-acinq
07b022e7fb
Split SendPayment in SendPaymentToRoute and SendPaymentToNode (#1921)
In case we want to retry, this allow us to know what we started with and not try to find a new route when using `SendPaymentToRoute`
2021-08-30 13:15:27 +02:00
Bastien Teinturier
fc36321403
Add TlvStream to all lightning messages (#1891)
This ensures we'll be able to easily enrich messages with future
tlv fields and minimizes the risk of future backwards-compatibility
issues.
2021-08-25 13:36:28 +02:00
llya Evdokimov
759c87fc09
Add advanced configuration details in README.md (#1915)
Add details about advanced bitcoin configuration options and JVM customization.
2021-08-25 09:14:20 +02:00
Bastien Teinturier
c504658264
Better handling of remote commit confirmation in TxPublisher (#1905)
* Never retry anchor publish when commit confirmed

We used to check the feerate before checking whether the commit tx was
already confirmed: when the commit feerate was good enough, we would
respawn a publish actor every block whereas the commit tx was already
confirmed.

* Abandon evicted replaceable txs

This ensures the bitcoind wallet won't keep the transaction around and
avoid using its inputs for other transactions.

Fixes #1898
2021-08-23 10:21:11 +02:00
Bastien Teinturier
9a0fc14710
Nicer feerate string representation (#1908)
Override toString() for the various feerate classes.
2021-08-18 12:35:26 +02:00
Bastien Teinturier
49e1996391
MPP scale min part amount based on total amount (#1911)
Scale MPP partial amounts based on the total amount we want to
send and the number of parts we allow.

This avoids polluting the results with cheap routes that don't have the
capacity to route when the amount is big.
2021-08-17 16:35:43 +02:00
thomash-acinq
ebed5ad9ea
Add cost per hop and base weight ratio (#1815)
- Add a base weight ratio. Allows to give more weight to the fee itself. Setting the base to 1 is like not using weight ratios.
- Add checks that the configuration values make sense (all weights should be nonnegative and sum to 1). Checks are performed when loading the configuration.
- Add a virtual cost per hop which allows prioritizing short paths. The cost per hop has a base component and a proportional one, similar to channel fees.
2021-08-17 12:36:29 +02:00
thomash-acinq
aab83fdfbc
Don't add channel update to auditDb if it hasn't changed (#1906)
Don't add channel update to auditDb if it hasn't changed
2021-08-17 10:28:25 +02:00