1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-19 18:10:42 +01:00
Commit Graph

865 Commits

Author SHA1 Message Date
Bastien Teinturier
92e53dc9a9
Configurable anchor output max commitment feerate (#1718)
It makes sense to allow node operators to configure the value they want
to use as a maximum threshold for anchor outputs commitment tx feerate.

This allows node operators to raise this value when mempools start getting
full in anticipation of a potential rise of the min-relay-fee.

This value can also be overridden for specific nodes.
2021-03-08 16:03:39 +01:00
Bastien Teinturier
c4c0248ee3
Use bech32 addresses by default (#1717)
Drop mention of p2sh-segwit. We should encourage users to use bech32.
2021-03-05 17:47:37 +01:00
Bastien Teinturier
afa378fbb7
Fix Bolt 3 spec change that broke our test suite (#1719)
We just merged lightningnetwork/lightning-rfc@b201efe in the spec
which added Bolt 3 tests, invalidating one of our tests and failing the build.
2021-03-05 13:48:31 +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
264688622f
fixup! Improve channel state tests (#1709) (#1712) 2021-03-01 13:54:25 +01:00
Pierre-Marie Padiou
8d4da2faad
Improve channel state tests (#1709)
* add tests on funding mindepth

We verify that when using wumbo channels:
- if we are funder we keep our regular min_depth
- if we are fundee we use a greater min_depth

* use lenses to simplify tags handling

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-02-26 18:24:45 +01:00
Pierre-Marie Padiou
8065d0bb80
Add a serializer for DoSync (#1708)
This command is sent by the `Peer` to its `PeerConnection`, therefore it
needs to be a `RemoteType` and have its own codec.
2021-02-26 12:09:21 +01:00
Bastien Teinturier
5d662fc3d7
Set anchor output feerates when force-closing (#1702)
When using anchor outputs, the commitment feerate is kept low (<10 sat/byte).
When we need to force-close a channel, we must ensure the commit tx and htlc
txs confirm before a given deadline, so we need to increase their feerates.

This is currently done only once, at broadcast time.
We use CPFP for the commit tx and RBF for the htlc txs.
If publishing fails because we don't have enough utxos available, it will
be retried after the next block is confirmed.

Note that it's still not recommended to activate anchor outputs.
More work needs to be done on this fee bumping logic and utxos management.
2021-02-24 19:28:44 +01:00
Bastien Teinturier
bf2a35f74c
Relay partially failed htlcs when closing (#1706)
If a channel closes when we've received an UpdateFailHtlc, signed it but
not yet received our peer's revocation, we need to fail the htlc upstream.

That specific scenario was not correctly handled, resulting in upstream
htlcs that were not failed which would force our upstream peer to close
the channel.
2021-02-24 19:08:51 +01:00
Pierre-Marie Padiou
a3c477e3f7
Address all intellij warnings for Channel.scala (#1705) 2021-02-24 18:13:02 +01:00
Pierre-Marie Padiou
d02b900a0c
Fix annoying compiler warning (#1704)
This fixes the `multiarg infix syntax looks like a tuple and will
be deprecated` warning.
2021-02-24 15:13:23 +01:00
Pierre-Marie Padiou
c1bf9bd100
Optimize watching for spending txs (#1699)
Since we almost always know which transactions will spend the utxos that we are watching, we can optimize the watcher to look for those instead of starting from scratch.
2021-02-24 14:37:43 +01:00
Bastien Teinturier
fa759f1e6b
Fix PaymentLifecycle warning (#1703)
Type is erased at runtime, but it's not needed, so let's simply remove it.
2021-02-23 12:04:35 +01:00
Thomas Profelt
5163749a9a
[eclair-cli] Use multiplatform escape sequence
Also added cli `findroutebetweennodes` to the commands list.

Fixes #1206
2021-02-22 18:14:49 +01:00
Bastien Teinturier
d9c0b862bb
Refactor bitcoin clients (#1697)
And improve test coverage specifically for the calls we'll rely on for CPFP
and RBF.
2021-02-19 14:33:48 +01:00
Bastien Teinturier
083515086f
Update funding timeout fundee (#1692)
Our previous timeout was based on timestamps, mostly because blockCount
could be 0 on mobile using Electrum until a new block was received.
Now that we're diverging from the mobile wallet codebase, we can use block
heights instead which is more accurate.

See lightningnetwork/lightning-rfc#839
2021-02-19 14:16:30 +01:00
Bastien Teinturier
ab89851cdf
Relax single tx input requirements (#1677)
In some places of the codebase we relied on the fact that lightning transactions
had a single input. That was correct with the standard commitments format,
but will not be the case with anchor outputs: 2nd-stage txs (htlc-txs) and
3rd-stage txs (claim-htlc-txs) can be RBF-ed and have any number of inputs
and outputs.
2021-02-18 15:39:08 +01:00
Bastien Teinturier
9618a6a79c
Add a maximum fee threshold for anchor outputs (#1672)
With anchor outputs, the actual feerate for the commit tx can be decided
when broadcasting the tx by using CPFP on the anchor.

That means we don't need to constantly keep the channel feerate close to
what's happening on-chain. We just need a feerate that's good enough to get
the tx to propagate through the bitcoin network.

We set the upper threshold to 10 sat/byte, which is what lnd does as well.
We let the feerate be lower than that when possible, but do note that
depending on your configured `feerate-tolerance`, that means you can still
experience some force-close events because of feerate mismatch.

Fix anchor outputs closing fee requirements: when using anchor outputs,
the mutual close fee is allowed to be greater than the commit tx fee,
because we're targeting a specific confirmation window.

Fix fee mismatch without htlc: we allow disagreeing on fees while the channel
doesn't contain any htlc, because no funds can be at risk in that case.
But we used the latest signed fee when adding a new HTLC, whereas we must
also take into account the latest proposed (unsigned) fee.
2021-02-18 14:20:36 +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
3a94a80447
Reject unreasonable remote dust limit (#1694)
It makes no sense to use a dust limit that's much higher than what bitcoin
mandates, so we should not allow our peer to use invalid values.
2021-02-17 15:17:44 +01:00
Bastien Teinturier
82e5b5968d
Sort addresses in node announcement (#1693)
Addresses in node announcement should be sorted.
We accept node announcements that don't do this, but we should do it for
our own announcements.

See https://github.com/lightningnetwork/lightning-rfc/pull/842
2021-02-17 15:12:39 +01:00
Bastien Teinturier
2a359c6a56
Publish txs with min-relay-fee met (#1687)
When our mempool is full, its min-relay-fee may be constantly changing.
To ensure our txs can be published, we need to check the min-relay-fee when
we fund the transaction, and raise it if necessary.
2021-02-15 19:17:48 +01:00
Bastien Teinturier
36e8c056f1
Shutdown and UpdateFee should not be intertwined (#1661)
We were not correctly handling intertwined `update_fee` and `shutdown` 
and could end up stuck between shutdown and negotiating.
2021-02-15 18:33:31 +01:00
Bastien Teinturier
fdeb3ce7e1
Correctly set gossip sync_complete (#1668)
We are restoring the previous behavior of using the `sync_complete` field
to signal the end of a `channel_range_query` sync.

The first step is to correctly set that field, before we can read it and
interpret it to mark the end of sync.

See https://github.com/lightningnetwork/lightning-rfc/pull/826
2021-02-15 17:05:48 +01:00
Bastien Teinturier
72179de0a4
PaymentLifecycle handle disconnected peers (#1688)
When a peer is disconnected, the register will return a forward failure.
This can happen if the peer is connected when we start the payment FSM and
then disconnects before we send them an HTLC.
2021-02-12 18:42:46 +01:00
Bastien Teinturier
15c1837d84
Add tx signing metrics (#1659)
Monitor the rate at which we sign channel txs and the duration of the
signing operations.
2021-02-12 12:10:56 +01:00
Bastien Teinturier
5d3958dd03
Fix MPP path-finding edge case (#1685)
Obviously the route amount must be strictly positive.
We don't control htlcMinimumMsat (it is set by our peer) and for backwards
compatibility reasons we allow it to be 0 msat (even though it doesn't make
much sense), so we need to enrich our condition to detect empty channels.
2021-02-08 11:49:38 +01:00
Aris
63d972bdc6
Fix a few typos (#1684)
Fix a few typos in the documentation and variable names.
2021-02-08 11:20:23 +01:00
Bastien Teinturier
f241ef933b
Remove support for initial_routing_sync (#1683)
We keep the GetRoutingState API available in the router as it's useful to
query network information locally (or between actors), but we stop sending
that data to remote nodes.
2021-02-04 16:53:41 +01:00
Bastien Teinturier
49023625b2
Refactor channel test helpers (#1682)
It's useful to separate channel state test methods in a dedicated trait
instead of always bundling it with `FixtureTestSuite`.

In particular, it was previously impossible to use both `BitcoindService`
and `StateTestsHelperMethods` because `BitcoindService` doesn't work with
fixtures (it leverages `beforeAll` and `afterAll` instead because launching
one bitcoind instance per-test would be too expensive and useless).
2021-02-04 16:52:05 +01:00
Pierre-Marie Padiou
d05318832f
Truncate hex strings in front logs (#1679)
Front-end logs can produce a huge amount of logs, with significant
duplication. In order to reduce the log volume, we truncate `nodeId` and
`channelId` in the MDC to only keep the first 8 hexadecimal characters.

Also, override a few `toString` because some channel-queries-related
case classes produce huge strings.
2021-02-04 16:46:49 +01:00
Bastien Teinturier
ac054a2bb2
Only sync with channel peers (#1587)
This reduces the bandwidth used: it doesn't make sense to sync with every
node that connects to us.

We also better track sync requests, to reject unsolicited sync responses.

To ensure that nodes don't need to explicitly reconnect after creating
their first channel in order to get the routing table, we add a mechanism
to trigger a sync when the first channel is created.
2021-02-04 15:27:08 +01:00
Bastien Teinturier
0127ace408
Remote failure updating routing hint (#1675)
The routing hint we get in a Bolt 11 invoice may be obsolete when we attempt
the payment: one of the nodes in the route may have updated his relay fees.

Since this affects a private channel that is not kept in the routing graph,
we need to update the routing hints before injecting them in the router.
This was already done in `PaymentLifecycle` with automatic retries, but when
using MPP we retried in the `MultiPartPaymentLifecycle` instead of inside
the `PaymentLifecycle`, so we need to handle routing hints updates there.
2021-02-01 11:39:55 +01:00
Pierre-Marie Padiou
c75d91436d
Fix failing reconnection tests (#1678)
Some reconnection tests seem to be overly strict, it makes them flaky for
no good reason (or so it seems).
2021-02-01 10:58:03 +01:00
Bastien Teinturier
34e901db75
Clarify default relay fee change (#1673)
Clarify why we don't actively update channel relay fees when the default
values change in eclair.conf. It would override manual changes made via
the API which is bad.
2021-01-20 18:52:18 +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
81f15aabd9
Refactor and improve some channel tests (#1654)
* Add a few more tests around channel_reestablish scenarios.
* Enrich existing tests and refactor common parts.
2021-01-19 16:51:25 +01:00
Bastien Teinturier
9c4ab7d923
Fix HTLC fulfill race condition in integration spec (#1666)
We were extracting F's commit tx from its internal state right after receiving
the `PaymentSent` event. The issue is that this could happen before the fulfill
was completely signed on both sides, so the commit tx we obtained would still
contain the HTLC and would be different from the one F would publish when
closing.
2021-01-19 15:56:16 +01:00
Bastien Teinturier
d40b321d92
Blockchain watchdogs use unique actor name (#1667)
Actor names cannot conflict.

Even though blockchain watchdog actors stop themselves after fetching block
data, when blocks are found in a short interval, we may end up with multiple
actors of the same type simultaneously alive, so we need them to have
unique names.

The blockcount isn't sufficient to make their names unique because forks
can happen.

Fixes #1665
2021-01-19 15:50:15 +01:00
Bastien Teinturier
e369ba9a1e
More aggressively re-emit private channel updates (#1671)
We had a delay mechanism before re-enabling reconnected channels
to avoid creating frequent channel updates on flappy connections and flooding
the network with unnecessary gossip.

We don't need this protection for private channels since they're not gossiped
to the rest of the network. And in the case of private channels to mobile
wallets, we don't want to add any delay, otherwise the reconnected channel
will not be in the router's graph and we'll have issues routing payments to
that wallet (especially if they quickly disconnect, before our 10-seconds
delay).
2021-01-19 15:41:12 +01:00
Bastien Teinturier
629c2e69ca
Fix rare race conditions in integration tests (#1653)
When a channel goes to the CLOSED state, the actor will stop itself.

We were previously sending messages to the actor asking for its state,
which returns a failure when the actor is stopped. We can simply listen
to state events to safely get the same result.
2021-01-06 18:38:18 +01:00
Bastien Teinturier
7343283f9f
Add test for duplicate temporary channel id (#1660)
This scenario was correctly handled, but we were missing test coverage.
2021-01-06 18:37:29 +01:00
Anton Kumaigorodski
dd8975aebe
Make ChannelVersion methods public (#1656) 2020-12-29 15:40:40 +01:00
Anton Kumaigorodski
5f9d0d9108
Relax cltv-expiry-delta requirement when selecting a channel to relay (#1655)
We only need the `cltv-expiry-delta` offered to be greater than our
requirement instead of strictly equal.

Co-authored-by: t-bast <bastuc@hotmail.fr>
2020-12-29 14:21:51 +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
d44ff85d38
(Minor) Improve logs (#1648)
We need to manually set the MDC in `onTermination` handler because the `StopEvent` isn't processed like a regular message by the actor.
2020-12-18 14:10:55 +01:00
Bastien Teinturier
5e6c28e8f8
ElectrumWatcher: fix for unconfirmed txs (#1647)
Electrum can return unconfirmed txs in an address' history. When that
happens, we should not try to fetch its confirmed position, it will
return an error.

We simply need to ignore these events and wait for the tx to confirm.
2020-12-18 11:35:17 +01:00