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

742 commits

Author SHA1 Message Date
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
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
1605c0435d
Introduce ChannelRelayParams in the graph (#2264)
We have two sources for channel routing parameters:
- channel updates
- routing hints in invoices

Instead of generating fake `channel_update`s from routing hints, we
define a `ChannelRelayParams` that can be built from announcements
or routing hints.

This is cleaner but also is a first step to decorrelate the identifier
of a channel in our graph, from whatever identifies the source.
2022-05-12 17:37:09 +02:00
Bastien Teinturier
9a31dfabea
Rename channel funder to initiator (#2236)
With dual funding, both peers may be funders, but only one of them is the
initiator. This is just a dumb renaming, there is not logic change.
2022-04-14 11:23:42 +02:00
Thomas HUET
c7c515a0ed
Add Bolt12 types and codecs (#2145)
Add types for representing offers and Bolt12 invoices (lightning/bolts#798)
2022-04-13 11:26:03 +02:00
Fabrice Drouin
787c51acc2
Add a "stop" API method (#2233)
* Add a "stop" API method

This API call was added for certain uses cases where killing the process was impractical but internally it just calls `sys.exit()`.
Eclair is designed to shutdown cleanly when its process is killed and this is still the recommended way of stopping it.
2022-04-13 09:48:12 +02:00
Fabrice Drouin
7883bf621d
Use bitcoin-kmp through bitcoin-lib (#2038)
We use a version of bitcoin-lib that uses bitcon-kmp under the hood.
Its API is the same as before, but its package is now fr.acinq.bitcoin.scalacompat
2022-04-05 17:04:33 +02:00
Richard Myers
9358e5e1f5
Add channelbalances API call (#2196)
The `channelbalances` API call retrieves information about the balances of all local channels, not just those with usable outgoing balances that are enabled for sending.

This change also adds the `isEnabled` attribute to the json results for both the new `channelbalances` and old `usablebalances` API calls.
2022-03-29 11:10:42 +02:00
Pierre-Marie Padiou
6823309874
Use NodeAddress everywhere instead of InetAddress (#2202)
* use `NodeAddress` everywhere instead of `InetAddress`

This makes us control more strictly when and where name resolution happens, which is important in a security-hardened setup. The `InetAddress` jdk class indeed does a lot of things behind the scenes, but now we restrict it to tcp-related classes like `Client` and `Server`.

Also, in _cluster mode_ all outgoing connections (including tor) are now made on the front.

* upgrade guava and rewrite nodeuri tests

There is no reason to use the version of guava targetting android anymore. Also `HostAndPort` was in beta in our current lib version.

We now use guava's `InetAddresses.toUriString()` to format host string, instead of manually adding brackets.

Reworked `NodeURI` tests:
- less repetition with one single test and multiple `testCases`
- focus on non-reg (no need to verify what we know we don't support)
2022-03-25 14:32:35 +01:00
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