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

683 commits

Author SHA1 Message Date
Thomas HUET
ab30af8fbc
minFinalExpiryDelta is not optional (#2195)
An invoice that doesn't explicitly set min_final_cltv_expiry has an default min_final_cltv_expiry of 18.
This default allows invoices to be slightly shorter but does not mean that the min_final_cltv_expiry can be unknown and needs to be provided from somewhere else.
2022-03-02 13:54:46 +01:00
Bastien Teinturier
99aabdabd0
Add txId in logback.xml (#2183)
We changed the logging MDC key for tx-publishing in #2131, but forgot to
add a formatting rule in logback.xml for that new field, so it wasn't
written to logs.
2022-02-17 08:19:00 +01:00
Pierre-Marie Padiou
ca71a3c152
Update a few dependencies (#2166)
This updates versions of a few major dependencies: scala, akka, postgres, etc.
2022-02-08 11:37:24 +01:00
Thomas HUET
4307bada51
Refactoring of PaymentRequest (#2144)
Refactoring of `PaymentRequest` to pave the way for bolt12 invoices

`PaymentRequest` is renamed to `Invoice` and is now a trait extended by `Bolt11Invoice` and `Bolt12Invoice`. `Bolt12Invoice` will come in a future PR.

Co-authored-by: t-bast <bastuc@hotmail.fr>
2022-02-02 17:29:15 +01:00
Bastien Teinturier
44510698f7
Back to Dev (#2159) 2022-02-01 10:42:29 +01:00
Bastien Teinturier
a804905c0b
Eclair v0.7.0 release (#2158) 2022-02-01 08:34:50 +01:00
Pierre-Marie Padiou
57c2cc5df9
Type ChannelFlags instead of using a raw Byte (#2148)
This has the same kind of impact as the typing of `Features`. In particular we can now explicitly set the values in `eclair.conf`:
`eclair.channel.channel-flags.announce-channel=true`. I took the opportunity to move this channel-related config key in its own config section, with the goal that we move the other fields in a follow-up PR.

It also has the nice side effect of providing a pretty json formatting out of the box:
```json
"channelFlags": {
  "announceChannel": true
}
```

The `open` method of the API has been updated: `channelFlags` has been replaced by a new `announceChannel` parameter.
2022-01-25 18:35:32 +01:00
Pierre-Marie Padiou
2f07b3ec0b
(Minor) Nits (#2139)
* consistency in feature names

Since we're not always following the `option_` prefix from the spec,
let's at least be consistent with ourselves.

* add alternative to `def nodeFees()`
2022-01-21 10:14:50 +01:00
Bastien Teinturier
58f9ebc624
Use BlockHeight everywhere (#2129)
We now have this better type to remove ambiguity.
We should use it wherever it makes sense.
There shouldn't be any business logic change in this commit.
2022-01-19 11:31:54 +01:00
Pierre-Marie Padiou
27579a5786
(Minor) Use sys package instead of System when applicable (#2124)
Use scala's `sys.exit()` instead of java's `System.exit()`, etc.
2022-01-06 18:55:46 +01:00
Thomas HUET
7421098c44
Process replies to onion messages (#2117)
Add a postman that is in charge of sending messages and listens to incoming replies and delivers them to the right actor
2022-01-05 16:37:52 +01:00
Pierre-Marie Padiou
1fd6344a5d
Define 9999-12-31 as max value for timestamps (#2118)
This effectively reverts #2112 and implements it differently.

Having a single very conservative max value is simpler and the risk of regression is very low. Also fixed a wrong comment, previous max wasn't `11/04/2262` but a huge value.
2022-01-03 16:00:38 +01:00
Fabrice Drouin
0b807d257a
Set max timestamp in API call to 9999/12/31 (#2112)
Previous value was 10001950-04-24 09:07:11+00 which is out of range for Postgresql.
9999 seems far away enough for most databases.
2021-12-20 19:54:34 +01:00
Bastien Teinturier
40cc458043
Switchboard exposes peer information (#2097)
The switchboard is our singleton actor entry point to all of our peers and
peer connections, it can be useful to have it deliver basic information
about our peers.

We also take this opportunity to fix a bug: we were not emitting the
`LastChannelClosed` event when it happened while the peer was
disconnected.
2021-12-10 18:40:10 +01:00
Bastien Teinturier
62cc073d67
Remove network stats computation (#2094)
We introduced a task to regularly compute network statistics (mostly about
channel parameters such as expiry and fees).

The goal was to use this information in the MPP split algorithm to decide
whether to split a payment or not.

But we haven't used it, and I'm not sure anymore that it's useful at all.

If node operators are interested in network statistics, an ad-hoc
on-the-fly computation would make more sense.
2021-12-09 11:58:04 +01:00
Thomas HUET
a470d41a95
Write received onion messages to the websocket (#2091) 2021-12-09 10:56:05 +01:00
Thomas HUET
9792c725c7
Rename feeThresholdSat to maxFeeFlatSat (#2079) 2021-11-29 17:51:39 +01:00
Thomas HUET
59b403559b
Relay onion messages (#2061)
* Relay onion messages

Allow sending and relaying onion messages

Co-authored-by: Pierre-Marie Padiou <pm47@users.noreply.github.com>
Co-authored-by: t-bast <bastuc@hotmail.fr>
2021-11-29 14:00:23 +01:00
Pierre-Marie Padiou
e54aaa84be
API: fix default time boundaries (#2035)
Default upper bound was `Long.MaxValue unixsec` which overflowed when converted to `TimestampMilli`. We now enforce `min` and `max` values on timestamp types.

API tests didn't catch it because eclair is mocked and the conversion happens later.

Fixes #2031.
2021-10-25 14:41:04 +02:00
Bastien Teinturier
765a0c5436
Add log file for important notifications (#1982)
Add a new log file for important notifications that require an action from
the node operator.

Using a separate log file makes it easier than grepping specific messages
from the standard logs, and lets us use a different style of messaging,
where we provide more information about what steps to take to resolve
the issue.

We rely on an event sent to the event stream so that plugins can also pick
it up and connect with notification systems (push, messages, mails, etc).
2021-10-25 11:21:39 +02:00
rorp
bdef8337e8
Additional parameters for findroute* API calls (#1969)
Add options to ignore specific channels or nodes for
findRoute* APIs, and an option to specify a flat maximum
fee.

With these new parameters, it's now possible to do circular
rebalancing of your channels.

Co-authored-by: Roman Taranchenko <romantaranchenko@Romans-MacBook-Pro.local>
Co-authored-by: t-bast <bastuc@hotmail.fr>
2021-10-22 09:04:29 +02:00
rorp
f3b16047eb
Add API to delete an invoice (#1984)
Add API to delete an invoice.
This only works if the invoice wasn't paid yet.

Co-authored-by: Roman Taranchenko <romantaranchenko@Romans-MacBook-Pro.local>
Co-authored-by: t-bast <bastuc@hotmail.fr>
2021-10-20 22:56:40 +02:00
Pierre-Marie Padiou
b4d285f1c4
Proper types for UNIX timestamps (#1990)
We define `TimestampSecond` and `TimestampMilli` for second and millisecond precision UNIX-style timestamps.

Let me know what you think of the syntaxic sugar, I went for `123456 unixsec` and `123456789 unixms`.

Json serialization is as follows for resp. second and millisecond precision. Note that in both case we display the unix format in second precision, but the iso format is more precise:
```
{
  "iso": "2021-10-04T14:32:41Z",
  "unix": 1633357961
}
{
  "iso": "2021-10-04T14:32:41.456Z",
  "unix": 1633357961
}
```
2021-10-18 16:13:42 +02:00
Pierre-Marie Padiou
b22b1cbea7
Fix API hanging on invalid remote params (#2008)
* reproduce bug causing API hang at open

In case of an error when validating channel parameters, we do not
return a message to the origin actor. That translates to API hanging
until timeout.

Took the opportunity to test return values in other cases too.

* return an error to origin actor for invalid params

* WaitForFundingCreatedInternal -> WaitForFundingInternal

* add tests to WaitForFundingInternalStateSpec

* add tests to WaitForFundingConfirmedStateSpec

* API nits

We probably don't need to print the stack trace for API errors, and the
open timeout of 10s was a bit short (it has to be << 30s though).
2021-10-18 15:06:14 +02:00
Bastien Teinturier
57bf86044e
Back to Dev (#1993) 2021-10-08 09:58:47 +02:00
Bastien Teinturier
6817d6f26e
Eclair v0.6.2 release (#1992) 2021-10-08 09:21:34 +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
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
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
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
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
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
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
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
8f5f6ace54
Set relay fees per node and save them to database (#1890)
* Set relay fees per node and save them to database

- Fees are set per node instead of per channel (setting different fees for different channels to the same node is most probably an error)
- Fees are saved to a database so that we can keep a trace of historic fees and new channels with a known node use the fee that we set and not the default fee.
2021-08-11 18:02:27 +02:00
Bastien Teinturier
2d68bab303
Fix API substream materialization issues (#1884)
Akka-HTTP can throw this error when we're lazily serializing
response objects. We don't need that laziness, so we set the
strict mode at the top-level of our http stack.

Fixes #1855
2021-08-09 15:23:04 +02:00
Bastien Teinturier
cafaeedef4
Set version to 0.6.2-SNAPSHOT (#1888) 2021-07-19 17:14:08 +02:00
Bastien Teinturier
d3ae32326e
Set version to 0.6.1 (#1887) 2021-07-19 15:36:23 +02:00
Pierre-Marie Padiou
c8c5e76d24
Update akka-http-json4s dependency (#1889) 2021-07-19 14:07:16 +02:00
Pierre-Marie Padiou
c22596bb92
Update dependencies and enable fatal warnings (#1885)
Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-07-16 19:02:18 +02:00
Pierre-Marie Padiou
08faf3b7fd
Add json columns in Postgres (#1865)
A json column has been added to the few tables that contains an
opaque serialized blob:
- `local_channels.data`
- `nodes.data`
- `channels.channel_announcement`, `channels.channel_update_x`

We can now access all the individual data fields from SQL.

For the serialization, we use the same serializers than the one
that were previously used by the API. They have been moved to the
`eclair-core` module and simplified a bit.

There are two json data types in Postgres: `JSON` and `JSONB`. We use
the latter one, which is more recent, and allows indexing.

An alternative to this PR would have been to use columns, but:
- there would have been a *lot* of columns for the channel data
- every modification of our types would have required a db migration

NB: to handle non-backwards compatible changes in the json serializersi,
 all the json columns can be recomputed on restart by setting
`eclair.db.reset-json-columns=true`.

Change in in ChannelCodecsSpec:

The goal of this test is to make sure that, in addition to successfully
decoding data that encoded with an older codec, we actually read the
correct data. Just because there is no error doesn't mean that we
interpreted the data properly. For example we could invert a
`payment_hash` and a `payment_preimage`.

We can't compare object to object, because the current version of the
class has probably changed too. That's why we compare using the json
representation of the data, that we amend to ignore new or modified
fields.

After doing a manual comparison, I updated the test to use the current
json serializers, and replaced the test data with the latest json
serialization. This allows us to remove all the tweaks that we added
over time to take into account new and updated fields.
2021-07-08 15:02:27 +02:00
Pierre-Marie Padiou
bd57d41ef3
Add a globalbalance api call (#1737)
It returns an overall balance, separating onchain, offchain, and
removing duplicates (e.g. mutual closes that haven't reached min depth
still have an associated channel, but they already appear in the
on-chain balance). We also take into account known preimages, even if
the htlc hasn't been formally resolved.

Metrics have also been added.

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-07-08 13:57:49 +02:00
Bastien Teinturier
bbfbad5975
Validate payment secret when decoding (#1840)
The `payment_secret` feature was made mandatory in #1810 and is the default
in other implementations as well. We can thus force it to be available when
decoding onion payloads, which simplifies downstream components (no need
to handle the case where a `payment_secret` may be missing anymore).

We also rename messages in `PaymentInitiator` to remove the confusion with
Bolt 11 payment requests.
2021-06-11 18:11:37 +02:00
Fabrice Drouin
dbecb28d96
Include routing hints in parseinvoice API call response (#1833)
JSON objects returned by parseinvoice do not include routing hints which can be misleading when decoding payment requests created by mobile wallets.
2021-06-01 16:06:38 +02:00
Pierre-Marie Padiou
f829a2e8ca
Add json type hints on channel data (#1824)
This is particularly helpful when in `OFFLINE` state.
2021-05-25 17:33:09 +02:00
Anton Kumaigorodski
d437ea1ed1
Improve API plugin support (#1819)
Move `onKit` before `startApiServiceIfEnabled`.
This allows plugins to properly initialize before providing their routes.
2021-05-25 13:01:20 +02:00
Anton Kumaigorodski
9a20aade0a
Allow plugins to inject their own routes into API (#1805)
Plugins can extend the `RouteProvider` trait to enrich the API with
custom calls, removing the need to setup a separate endpoint on a
different port.

When routes clash between plugins, the second one is simply ignored.
Plugin developers should prepend their route with their plugin name
to avoid such silent clashes.
2021-05-19 17:47:06 +02:00
Bastien Teinturier
76894bd2e1
Add additional PRNG (#1774)
In case of catastrophic failures of the `SecureRandom` instance, we add
a secondary randomness source that we mix into the random stream.

This is a somewhat weak random source and should not be used on its own,
but it doesn't hurt to xor it with the output of `SecureRandom`.

We use an actor that listens to events in the system and inject them
in our weak pseudo-RNG.
2021-05-19 15:29:32 +02:00