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

1851 commits

Author SHA1 Message Date
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
8cfa3f5c1b
Set the same priority for all routing messages (#1624)
Otherwise `ReplyShortChannelIdsEnd` may overtake announcements.

There is an exception for `AnnouncementSignatures` which is more a channel message than a routing message.
2020-12-07 15:22:03 +01:00
Pierre-Marie Padiou
ce73ef3a1a
Allow overriding of Tor target (#1617)
This is useful to redirect incoming tor traffic to eclair-front.
2020-12-03 10:56:40 +01:00
Anton Kumaigorodski
ed61b577df
Improve CustomCommitmentsPlugin methods (#1613)
* Add node params and logger parameters to plugin htlc methods
* Refactor helper function to make it available for plugins
2020-12-02 17:58:05 +01:00
Pierre-Marie Padiou
848b433836
Ack htlc settlement commands after writing state (#1615)
There are two issues:
1. because we forward commands *before* writing to disk in
   `PendingRelayDb.safeSend` in order to reduce latency, there is a race
   where the channel can process and acknowledge the command before the
   db write. As a result, the command stays in the pending relay db and
   will be cleaned up by the post-restart-htlc-cleaner at next restart.
2. in the general case, the channel acknowledges commands *before* it
   writes its state to disk, which opens a window for losing the command
   if we stop eclair at that exact time.

In order to fix 2., we introduce a new `acking` transition method, which
will be called after `storing`. This method adds a delay before actually
acknowledging the commands, which should be more than enough to solve 1.

I'm not sure we need that additional delay, because now that we
acknowledge the commands *after* storing the state, the channel should
lose the race most of the time.
2020-12-01 10:53:41 +01:00
Bastien Teinturier
6330e76daf
[CI] Exclude tests that call external APIs (#1622)
These tests have been flaky because external APIs tend to be down or throttle
our calls. and we don't want our test suite to fail because of that.

In practice it's enough if developers run these tests locally once in a while.
2020-11-30 18:10:21 +01:00
Bastien Teinturier
8bfb9f08e7
Clean up bitcoinheaders error logs (#1606)
When we query future blocks that bitcoinheaders.net doesn't have, instead
of returning a DNS resolve error, it returns a DNS response without a
block header.

We want to avoid logging it as an error, so we check for this specific case.
2020-11-23 10:03:36 +01:00
Anton Kumaigorodski
6b32fd06cf
Allow plugins to force reconnect (#1594)
This can be useful to keep connections alive even when there are no channels.
2020-11-19 09:59:49 +01:00
Bastien Teinturier
06c95a7ad2
Clarify trampoline to legacy diagram (#1607)
It was implicitly doing an MPP between t2 and f, but that was misleading.
MPP is now explicitly drawn to prevent confusion.
2020-11-18 18:18:55 +01:00
Anton Kumaigorodski
407b330f04
Remove timedOutOutgoingHtlcs from AbstractCommitments (#1604) 2020-11-16 14:30:45 +01:00
Bastien Teinturier
54b589cb22
Improve MPP-send for direct channels (#1599)
When the recipient is a direct peer, we can use the accurate knowledge
of our local channels instead of hard-coded MPP parameters to choose
the number of routes and the minimum route amount.

This change makes it possible to easily send all local funds in one
payment when we're directly connected to the recipient.
2020-11-13 12:10:07 +01:00
Anton Kumaigorodski
c0e38841fc
Add a test to ensure NodeParams.nodeId always equals NodeParams.privateKey.publicKey (#1593) 2020-11-13 09:25:13 +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
c0d465c409
Fix NodeRelayer flaky test (#1588)
This test was randomly failing because of a race condition: we sometimes
sent the payment failure before the payment FSM asked for routes, so it
was ignored and the test could not progress.
2020-11-06 11:20:22 +01:00
Pierre-Marie Padiou
59449bfcfc
Increase docker timeouts for electrumx in tests (#1589) 2020-11-06 11:19:21 +01:00
Donovan
f32e75b006
Segregate the node seed from the channel seed (#1584)
* Segregate the node seed from the channel seed

- change getSeed signature
- change LocalKeyManager signature
- implement getSeeds to return both nodeSeed and channelSeed
- use separate seeds for node and channels
- update README
- create NodeKeyManager & ChannelKeyManager
- add migration tests
* add NodeParams.scala
* add Setup.scala
* remove KeyManager trait, add NodeKeyManager & ChannelKeyManager traits
* remove LocalKeyManager, add LocalNodeKeyManager & LocalChannelKeyManager
* remove LocalKeyManagerSpec, add LocalNodeKeyManagerSpec & LocalChannelKeyManagerSpec
* add Seeds class instead of ordering the seeds (fix by @t-bast)
* update usage of ChannelKeyManager class
* add signChannelAnnouncement method to each KeyManager
* fix seeds tests
* use snake_case for filename
* create crypto.keymanager package
* improve variables names
2020-11-05 11:33:50 +01:00
Bastien Teinturier
c556654093
Add blockchain watchdog (#1545)
Introduce a blockchain watchdog that fetches headers from multiple sources
in order to detect whether we're being eclipsed.

Use blockchainheaders.net, blockstream.info, blockcypher.com and mempool.space
as first sources of blockchain data. More blockchain sources can be be added
later.
2020-11-03 17:38:46 +01:00
Anton Kumaigorodski
366f9befdd
Add a case object to get router data (#1581) 2020-11-02 12:18:27 +01:00
Bastien Teinturier
1f90e5b80a
Add per-node feerate tolerance (#1575)
When we have a trusted relationship with some of our peers (business
relations, family members, our own mobile wallet, etc) it makes sense to
relax the feerate mismatch constraint.

This must be done per-node, to avoid leaving the gates open for attackers.
2020-10-23 09:31:34 +02:00
Bastien Teinturier
baa226964f
Rework features compatibility (#1576)
The `supportedMandatoryFeatures` set made less and less sense as we start
supporting more features and allowing users to turn features on and off
depending on the peers they connect to.
2020-10-23 09:30:38 +02:00
Anton Kumaigorodski
28f72e412b
Remote address in ConnectionInfo (#1579) 2020-10-22 11:57:14 +02:00
Bastien Teinturier
e74f345817
Clarify crossSign helper functions (#1578)
It's important in particular to highlight the case where an HTLC is
half-fulfilled or half-failed.
2020-10-22 11:20:08 +02:00
Bastien Teinturier
98508f3041
Fix empty replyTo in update_relay_fee (#1572)
Fixes #1570.
2020-10-20 11:01:26 +02:00
Pierre-Marie Padiou
ad17683b0f
(Minor) Fix Features.toString (#1573) 2020-10-19 17:28:21 +02:00
Anton Kumaigorodski
b0716aea88
Make Commitments a trait (#1542)
This allows easier implementation of Hosted Channels as a plugin.
2020-10-19 10:04:50 +02:00
Pierre-Marie Padiou
9c16bb75c2
Manual watching of peer-connection actor (#1567)
Instead of `Peer` watching `PeerConnection`, we have `PeerConnection`
notify `Peer` when it dies. Not relying on a watch allows for harder
security settings when enabling akka cluster.
2020-10-15 17:44:40 +02:00
Pierre-Marie Padiou
90bf08e62c
Update akka to 2.6.10 (#1568) 2020-10-15 16:26:46 +02:00
Bastien Teinturier
bffb7a3fe1
Fix race condition in integration test (#1564)
In the revoked commit tx case, both nodes are competing to claim the
HTLC outputs from the commit tx.

The test incorrectly assumed that node F would always win that race.
2020-10-15 16:23:33 +02:00
Bastien Teinturier
131b2e01c5
Add workaround for lnd sync issue (#1563)
When a channel gets confirmed while nodes are disconnected, recent lnd
nodes sometimes fail to send their channel_reestablish message and instead
send a funding_locked first (due to a race condition on their side).

When that happened, the channel stayed stuck in the SYNCING state.
To avoid that, we trigger a reconnection until the race condition is eventually
won by the channel_reestablish.
2020-10-14 13:22:37 +02: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
3e3397cfb1
Fix Docker JAVA_OPTS expansion (#1561) 2020-10-13 11:44:34 +02:00
Donovan
4b55d3e71c
Fix typo in startup script (#1559) 2020-10-13 09:52:37 +02:00
Bastien Teinturier
3da76c08ae
Allow mandatory static-remotekey (#1558)
Since we optionally support static-remotekey, we should allow our peers
to make it mandatory if they wish.
2020-10-12 15:09:09 +02:00
Bastien Teinturier
a76db1c27b
Fix channel CMD_SIGN (#1556)
We're sending the type instead of sending an instantiated class...
Other commands were affected and are now fixed.
2020-10-12 10:42:48 +02:00
Anton Kumaigorodski
135ce6cc8b
Use maven plugin to include tests (#1557)
This results in eclair-core_2.13-<version>-tests.jar file and allows to easily reuse testing classes in other modules.
2020-10-12 10:41:52 +02:00
Bastien Teinturier
50363569c7
Fix forceclose API (#1555)
It was simply missing a sender ActorRef.
2020-10-09 18:29:16 +02:00
Pierre-Marie Padiou
eea1ba99b9
Add backward-compatibility tests on some database codecs (#1554)
* add backward compat tests on cmd codecs

* add backward compat test on feerate codec
2020-10-09 17:02:33 +02:00
Bastien Teinturier
b728520ad7
Prevent disabling var_onion_optin (#1552)
There is no good reason to completely disable `var_onion_optin` and it can
even be harmful: pending HTLCs after a restart may be lost if they used a
variable-length onion, causing a loss of funds and potential channel closes.
2020-10-09 16:50:38 +02:00
Pierre-Marie Padiou
ed61750436
Nits (#1553) 2020-10-09 11:30:14 +02:00
Pierre-Marie Padiou
20e0b4bc4d
Fix override-features implementation (#1549)
We were calling `nodeParams.features` from inside the channel, which is
problematic because we may have overridden those features for specific
peers. This is now fixed.
2020-10-08 17:59:01 +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
8885ed7f4a
(minor) Improve logs in channel relayer (#1550) 2020-10-07 15:51:07 +02:00
Pierre-Marie Padiou
56d216b91b
Separate configuration for peer-connection (#1548)
Features are now provided by the `switchboard`, in response to the
`PeerConnection.Authenticated` message.

The `switchboard` will also decide whether or not we sync with that
peer, depending on the `syncWhiteList` configuration.
2020-10-02 17:12:51 +02:00
Bastien Teinturier
382868dda2
[ChannelRelay] Prioritize lowest capacity channels (#1539)
* [ChannelRelayer] Expose Wrapped messages to tests

Exposing the private wrapped messages to tests allows removing the
dependency on capturing logs which felt very brittle.

* Prioritize low capacity channels during relay

This makes it more difficult for attackers to "squat" high-capacity channels
by sending HTLCs and then hodling them.

It results in less locked liquidity during this kind of attacks.
2020-10-02 10:09:32 +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
8a27b4ca85
Fixup funder fee buffer (#1364)
We were previously only counting the additional HTLC at twice
the current feerate.

An HTLC in isolation doesn't make much sense: the feerate
applies to the whole commit tx. Our fee buffer needs to account
for a x2 feerate increase on the commit tx + an additional htlc.

Note that this introduces another subtlety. The commit tx fee at twice the
current feerate may actually be lower than the commit tx fee at the current
feerate (if the commit tx contains many htlcs that are only slightly above
the trim threshold).
2020-09-29 18:06:38 +02:00
Bastien Teinturier
36c9b9b5a5
Configure bitcoin wallet (#1540)
Don't swallow bitcoind exceptions: we wrap them but preserve the
original one.

Allow configuring bitcoin core wallet: it makes sense to allow users
to use a different wallet from the default one.
There's one important caveat: once set, users shouldn't change it while
they have open channels. We mention it clearly in the documentation.

Fixes #1538
2020-09-28 12:07:15 +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
Bastien Teinturier
483cce4ae2
Split IntegrationSpec (#1535)
This change makes `IntegrationSpec` an abstract class trait that defines
common utilities used in most integration tests, and splits the actual tests
in two separate files that extend that class. Channel tests have themselves
been split between standard and anchor commitments to gain extra
parallelism.

The tests themselves aren't changed at all, except for the TCP ports they
use, and to remove nodes that have become useless in each of the specs. `expectMsg`
have been increased to 60 seconds to account for the increased parallelization.

Some tests have been refactored, cleaned up and block expiries have been reduced.
2020-09-24 18:58:17 +02:00