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

628 commits

Author SHA1 Message Date
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
Pierre-Marie Padiou
d0011005a0
Migrate relayers to akka typed (#1525)
* introduce a new relay identifier

In a channel relay, it will be unique for all retries.

In a trampoline relay, it is equal to what previously was the parent
payment id.

* moved and cleaned up remaining relayer tests

Now all relay-related tests are in the `relayer` package.
2020-09-16 09:46:51 +02:00
Pierre-Marie Padiou
6b05099f07
Use the replyTo pattern for Channel messages (#1520)
* typeify response to command messages

* Status.Failure(AddHtlcFailed)->RES_ADD_HTLC_FAILED

`AddHtlcFailed` is renamed `RES_ADD_FAILED` and it is just a particular
kind of `CommandError`

* remove Status.Failure from payment lifecycle

* use replyTo pattern in relayers

* return ForwardMessage in CommandResponse

Instead of having the channel send `Relayer.ForwardMessage` to the
relayer, we encapsulate the `Relayer.ForwardMessage` within a
`CommandResponse[CMD_ADD_HTLC]`.

It looks like a cosmetic change, but it's not: now when the relayer
sends a `CMD_ADD_HTLC` to the channel, it will receive one or more
`CommandResponse[CMD_ADD_HTLC]`, for example:
- success scenario:
  - `RES_SUCCESS[CMD_ADD_HTLC]`
  - `RES_ADD_COMPLETED[RelayBackward.RelayFulfill]`
- htlc failed by downstream
  - `RES_SUCCESS[CMD_ADD_HTLC]`
  - `RES_ADD_SETTLED[RelayBackward.RelayFail]`
- command rejected:
  - `RES_ADD_FAILED[_]`
- peer disconnected before signing:
  - `RES_SUCCESS[CMD_ADD_HTLC]`
  - `RES_ADD_FAILED[ChannelUnavailable]`

In addition to that, `RelayMessage` have been slightly refactored, to
better separate between `RelayForward` and `RelayBackward`.

This paves the way for typing `CMD_ADD_HTLC.replyTo` to
`ActorRef[CommandResponse[CMD_ADD_HTLC]]` and have the channel send all
related messages to the `replyTo` actor. Note that the `RelayForward`
actor will always be sent to the relayer, which makes sense since there
was no related command (the htlc was sent by the peer).

NB: `CMD_ADD_HTLC` is a special case, for all other commands there is
exactly one `CommandResponse[CMD_*]`, either `RES_SUCCESS[CMD_*]` or
`RES_FAILURE[CMD_*]`.

* use replyTo pattern in payment lifecycle

We were already close to this pattern with constructs like `case class
WaitingForRoute(sender: ActorRef, ...`

* typeify Origin/Upstream classes

The relationship between `Origin` and `Upstream` was obscure and they were
defined in two different files.

`Upstream` is the source of the payment in the context of a chain
of htlcs. For example, in the case of a typical relayed payment, it
would be an incoming htlc.

`Origin` is the source of the payment in the application: it can be an
actor, or nothing if the reference was lost after a restart.

Instead of using an `Option[ActorRef]` to differentiate between
known/unknown origin, new `Hot/Cold` traits that extend `Origin` have
been introduced. This means that now the `PostRestartHtlcCleaner` only
deals with `Cold` origins, whereas the `NodeRelayer` only handles `Hot`
origins. The channel codec will encode from both `Hot/Cold` origins, but
will only decode to `Cold`.

* refactor response types

Generalize the `CommandResponse[Command]` pattern for all commands.

There seem to be something ambiguous about the way we deal with closing
commands during the initialization phase of the channel. We used to
conflate `CommandResponse[CMD_CLOSE]` and
`ChannelOpenResponse.ChannelClosed` but those are not sent to the same
actors.

It turns out our testing of the `EclairImpl` class is very weak. We
could use this class in `IntegrationSpec` instead of sending raw
messages to channels.

* handle channel-relay in the post-htlc-restart too
2020-09-03 18:40:37 +02:00
Bastien Teinturier
daddfc007f
Type fee rates info (#1504)
* Type fee rates info

Fixes #1188

* Fix vsize comment

This is an alternative to #1425.
This may not correctly represent what Bitcoin Core does, it's likely that
we can in fact use a value smaller than 253, but this shows how we choose
to err on the side of safety with that calculation.

* Add 1008 feerate block target

Fixes #1486
2020-08-10 15:38:13 +02:00
Donovan
01f924ae86
Add API commands to sign & verify arbitrary messages (#1499)
It can be useful to sign arbitrary messages with the key associated with our node_id (to prove ownership of a node).

Adds 2 new API commands:
  eclair-cli signmessage --msg=${message}
  eclair-cli verifymessage --msg=${message} --sig=${signature}
2020-08-07 16:33:20 +02:00
Donovan
e6909cfcb5
Implement the KeySend feature, spontaneous payments (#1485)
Support for receiving and sending KeySend payment is added.

For an explanation of the KeySend feature see: https://github.com/ElementsProject/lightning/pull/3611
2020-07-21 16:30:03 +02:00
Bastien Teinturier
625e996ae0
Update MinFinalCltvExpiryDelta default value and activate wumbo (#1483)
* Activate wumbo by default

This is safe as `max-funding-satoshis` is set to 16777215 sats, which is
the non-wumbo limit.

If users want to increase the maximum channel size, they can update this
configuration value.

* Update default minFinalCltvExpiryDelta

See https://github.com/lightningnetwork/lightning-rfc/pull/785

* Set minFinalCltvExpiryDelta in invoices

Our default fulfill-safety-window is now greater than the spec's default
min-final-expiry-delta in invoices, so we need to explicitly tell payers
what value they must use.

Otherwise we may end up closing channels if a block is produced while we're
waiting for our peer to accept an UpdateFulfillHtlc.
2020-07-21 14:37:59 +02:00
Fabrice Drouin
ea57bb266c
Release 0.4.1 (#1481)
* Set version to 0.4.1

* Set version to 0.4.2-SNAPSHOT
2020-07-20 12:00:01 +02:00
rorp
b63c4aa5a4
Postgresql support (#1249)
Add beta support for PostgreSQL database backend.
2020-07-01 14:52:36 +02:00
Bastien Teinturier
7ec3ba829a
Fix channelstats (for real?) (#1470)
The channelstats API only returns results for the *outgoing* channels
used when relaying. We must also include the *incoming* channels, otherwise
it looks like they're inactive which doesn't reflect their real usage.

Fixes #1465
2020-06-30 17:11:04 +02:00
Bastien Teinturier
0563d6d6ce
Update allnodes API (#1468)
Rename to `nodes`.
Allow filtering for specific `nodeId`s.

Fixes #1460
2020-06-23 15:28:48 +02:00
Bastien Teinturier
676a45c19c
Add on-chain APIs (#1461)
* Add on-chain balance API: fixes #1457
* Add API to list wallet on-chain transactions: fixes  #1459
* Add API to send on-chain funds: fixes #1458
2020-06-19 18:02:39 +02:00
Bastien Teinturier
570fe57baa
Add friendly network name to GetInfo response (#1456)
This is friendlier to interpret than mapping this from the chain's genesis
block hash.
2020-06-19 16:07:08 +02:00
Bastien Teinturier
c04a4cef2a
Accept multiple channels for some API (#1440)
It's handy to update relay fees for multiple channels at once.
Closing and force-closing channels may also make sense to do in batch.

Closes #1432
2020-06-03 11:06:45 +02:00
araspitzu
029cafe297
Use human readable features in configuration (#1385)
* Parse human readable features from configuration, print features in human readable format.
2020-05-19 13:58:19 +02:00
Pierre-Marie Padiou
24b43e9a49
Use actor system as conf container (#1420)
This seems to be recommended practice:
https://doc.akka.io/docs/akka/current/general/actor-systems.html#configuration-container.

As a nice side effect, it allows putting akka-related config in eclair.conf.

Also, reorganize reference.conf/application.conf.
2020-05-18 17:12:21 +02:00
araspitzu
4e4c7c9366
Put shebang in first line of launcher scripts (#1423) 2020-05-18 16:00:03 +02:00
rorp
ff5362e4eb
Fix eclair-node.sh for OSX (#1424) 2020-05-15 08:51:22 +02:00
Bastien Teinturier
c4d0604b72
Payment lifecycle refactor (#1414)
* Extract faulty channels selection from PaymentLifecycle

Move the logic of figuring out which channels/nodes should be ignored
when retrying after a payment failure out of the PaymentLifecycle.

We can figure this out looking only at the `PaymentFailure` generated,
and the multi-part logic could leverage these helpers.

* Refactor RouteResponse

It was useless to return `ignoreNodes` and `ignoreChannels`, it's rather
the responsibility of the caller (PaymentLifecycle) to store and update
these sets.

Preparing for the MPP move inside the router, we introduce a Route class
and let RouteResponse return a collection of Routes.

This creates some ugliness in PaymentLifecycle because of the `routePrefix`,
but this is just temporary: the `routePrefix` "hack" will be removed soon.
2020-05-12 11:41:25 +02:00
Fabrice Drouin
273a3f0966
Release 0.4 (#1409)
* Release 0.4

* Set version to 0.4.1-SNAPSHOT
2020-05-05 14:55:09 +02:00