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

647 Commits

Author SHA1 Message Date
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
Bastien Teinturier
a658fa26f4
Set version to 0.6.1-SNAPSHOT (#1813) 2021-05-19 15:08:42 +02:00
Bastien Teinturier
f89b0925a7
Set version to 0.6.0 (#1812) 2021-05-19 11:54:44 +02:00
Pierre-Marie Padiou
223a14cb59
Remove bintray (#1785)
Bintray has been discontinued and artifacts have been migrated to Maven
Central.
2021-05-04 15:38:46 +02:00
Bastien Teinturier
62dd3932ff
Use bouncycastle instead of spongycastle (#1772)
* Use bouncycastle instead of spongycastle
* Reformat a few files
* Remove wireshark dissector support

Fixes #1375
2021-04-22 11:39:45 +02:00
thomash-acinq
15ddc17189
Add trampoline info to auditDB (#1767)
* Add trampoline info to auditDB

Add a new table containing the recipient and amount sent to the recipient in case of trampoline relaying.
When using trampoline, the recipient may not be the next node on the path.
2021-04-15 09:15:33 +02:00
Bastien Teinturier
5729b28912
Add blocking option to payinvoice API (#1751)
Add an option to block until the payment completes to the payinvoice API.
This can be simpler to use for payments that complete quickly.
2021-04-02 08:36:20 +02:00
Bastien Teinturier
7819faec39
Move protocol codecs to their own package (#1736)
This is a follow-up for #1732

Codecs in the protocol package will always be backwards-compatible,
as they are defined in the spec.
2021-03-23 13:57:02 +01:00
Pierre-Marie Padiou
6e72785d6c
fixup! Rework XxxCommitPublished types (#1728) (#1735) 2021-03-22 17:29:10 +01:00
Bastien Teinturier
6d28cbc8e1
Rework XxxCommitPublished types (#1728)
Re-work the `CommitPublished` types to work better with anchor outputs.
We previously stored the txs spending utxos that we could claim: this
doesn't make sense anymore if these txs may be RBF-ed, because the final
tx will be different from the initial one.

We instead track what `OutPoint`s we can claim, and the information
necessary to claim them. This way we can in the future let a different
actor finalize the txs that spend these outpoints (set the fees and sign).

We also add information on mutual close txs to immediately identify our
output and its amount: this makes auditing how much sats we'll get back
very easy from the API when we have many channels to watch.

This commit contains a DB migration of the channel data types, but in a
backwards-compatible way: we can still read from old data. The only
scenario impacted is channels that started force-closing before the migration.
They need special care to handle the fact that they had less data than
migrated channels, which is why we keep some legacy code around.
2021-03-22 15:44:38 +01:00
Bastien Teinturier
8dc64dbaa6
Fix API regression (#1729)
We incorrectly applied error handlers at each sub-route instead of applying
it after grouping all sub-routes together. The result was that only `getinfo`
could actually be called.
2021-03-12 18:32:47 +01:00
Thomas Profelt
9ff2f833e7
Refactor and simplify API dsl (#1690)
Refactor the API handlers.
Split handlers and directives in several files to make them more composable.

Co-authored-by: Pierre-Marie Padiou <pm47@users.noreply.github.com>
Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-03-09 15:23:50 +01:00
Bastien Teinturier
844829a9b1
Features should be a Map (#1715)
We previously used a Set, which means you could theoretically have a feature
that is both activated as `optional` and `mandatory`.

We change that to be a Map `feature -> support`.
2021-03-04 08:40:56 +01:00
Bastien Teinturier
163700a232
Set version to 0.5.2-SNAPSHOT (#1714) 2021-03-03 15:29:26 +01:00
Bastien Teinturier
98bb7be70a
Set version to 0.5.1 (#1707) 2021-03-03 11:38:00 +01:00
Pierre-Marie Padiou
3479669121
Disable jdbc instrumentation by default (#1713)
The module is still there and can be enabled if needed.
2021-03-01 15:10:30 +01:00
Thomas Profelt
fdb57b43d3
Find route between nodes (#1695)
Added additional method to Eclair like findRoute but allowing for 2 nodeIds.
Also added a new endpoint to the http Api "findroutebetweennodes" which
takes sourceNode and targetNode as params.

Fixes #1068
2021-02-18 13:55:50 +01:00
Bastien Teinturier
54ca292209
Remove kamon tracing (#1662)
It's costly, we're not using it, and it's too invasive.
There's no reason to keep it at the moment.
2021-01-20 18:35:16 +01:00
Bastien Teinturier
923ca26fec
Set version to 0.5.1-SNAPSHOT (#1651) 2020-12-18 16:24:32 +01:00
Bastien Teinturier
35b070ee5d
Set version to 0.5.0 (#1649) 2020-12-18 15:23:36 +01:00
Pierre-Marie Padiou
39d9bfbec5
Add cluster doc, and packaging improvements (#1646)
We now use a regular release zip, and use it in the awseb bundle.

The default logback configuration now logs to a file, like
`eclair-node`, and we use a dedicated logback configuration for AWS
beanstalk.

By default the front reads the node secret key from the node seed in
the standard `.eclair` directory.
2020-12-18 11:36:24 +01:00
Bastien Teinturier
413ee29dab
Fix htlc origin JSON serialization (#1641)
A recent refactoring to include a `replyTo` parameter made the JSON
serialization ugly and hard to work with.

Fixes #1611
2020-12-16 10:55:30 +01:00
Pierre-Marie Padiou
dae5eeedb3
Disable the distibuted pubsub extension by default (#1642)
It only needs to be enabled in cluster mode.
2020-12-16 10:51:25 +01:00
Bastien Teinturier
95b34f270f
Fix duplicate implicit btc amount conversions (#1637)
Bitcoin-lib introduced conversions from `Long` to bitcoin amounts.
It clashed with the ones previously defined in eclair.

Fixes #1632
2020-12-15 11:32:21 +01:00
Pierre-Marie Padiou
ade17ecb72
Use a local actorsystem by default (#1636) 2020-12-14 19:45:48 +01:00
Pierre-Marie Padiou
08c21fa5e9
Distribute connection-handling on multiple machines using akka-cluster (#1566)
The goal is to offload the back from everything connection-related:
- incoming connections
- outgoing connections
- gossip queries + pings
- incoming gossip aggregation
- outgoing gossip dispatch (rebroadcast)

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2020-12-08 18:41:51 +01:00
Bastien Teinturier
a4d184569b
Set initial relay fees during channel open (#1610)
It can be useful to override the default relay fees when opening channels
to specific nodes.

Note that these initial relay fees are not persisted in the DB. That means
that if your node reboots before the funding transaction confirms, the
channel will be opened with the default relay fees, not the overridden values.

Fixes #1507
2020-12-08 09:51:00 +01:00
Bastien Teinturier
a2a980c7bd
Add channelId to websocket event (#1605)
Thanks to recent changes, the channelId is available in ChannelStateChanged.
We now propagate this information to websocket channel events.
2020-12-07 15:31:09 +01:00
Anton Kumaigorodski
e5db314741
Allow plugins to provide broken HTLCs after a restart (#1586)
Plugins can now implement custom commitment schemes, different from specified ones.
This requires extra care when restarting a node, as some HTLCs may be in a broken state
and need to be failed upstream.

Plugins must identify these HTLCs and implement the right trait to provide these HTLCs to
the PostRestartHtlcCleaner, which will watch them and fail/fulfill them accordingly.
2020-11-09 09:10:21 +01:00
Bastien Teinturier
f9ff586cba
Release Eclair v0.4.2 (#1562)
* Set version to 0.4.2
* Set version to 0.4.3-SNAPSHOT
2020-10-13 15:14:40 +02:00
Donovan
4b55d3e71c
Fix typo in startup script (#1559) 2020-10-13 09:52:37 +02:00
Bastien Teinturier
428349a341
Send to channel route (#1537)
* Send payment through specific channels

While `sendtoroute` was letting you provide a custom route as a list of
nodes, it made it difficult to have fine-grain control over the channels
used by payments.

The API now allows choosing the exact channels that will be used for the
payment; in particular, this will be helpful when consolidating and
rebalancing multiple channels to a given node.

Fixes #1472

* Fix serialization regression

#1520 introduced a regression in the serialization of channel data,
impacted the `channels` and `channel` APIs.

We restrict the custom command response serializer to revert to the
previous behavior.
2020-10-08 15:43:52 +02:00
Pierre-Marie Padiou
1274168012
Make all commands extend Has*ReplyToCommand (#1543)
This way we can maintain replies in tests.
2020-09-30 10:05:55 +02:00
Bastien Teinturier
0ab7ec63f9
Add DB entry for payment router error (#1513)
When using MPP, if we can't find a route, we need to add an entry to the
DB. Otherwise when users query their payment status, nothing will be
returned which is a bad UX.

Fixes #1512
2020-09-29 18:08:08 +02:00
Bastien Teinturier
42481c66e6
Add some channel events to websocket (#1536)
Send basic channel events to websockets listeners:

* Channel open initiated
* Channel state change
* Channel closed

We only send basic, high-level data about these events.
If the listener is interested in details, it should call the `channelInfo`
API to get all of the channel's data.

Fixes #1509
2020-09-28 09:51:42 +02:00
Anton Kumaigorodski
3a773c1fd7
Allow plugins to handle custom messages and features (#1528)
Allow plugins to register unknown features and message types they're able to handle.
This allows plugins to add new features independently of what eclair-core understands.
Plugins are able to receive and send arbitrary lightning messages, and advertise support
for non-standard features freely.
2020-09-24 17:50:07 +02:00
Pierre-Marie Padiou
eed82e262f
Update to scala 2.13.3 and akka 2.6.9 (#1532)
Need to add explicit dependency on akka-stream (see https://doc.akka.io/docs/akka-http/current/introduction.html#using-akka-http)
2020-09-18 15:27:45 +02:00