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

1416 commits

Author SHA1 Message Date
Bastien Teinturier
148fc673d4
Add RPC to bump local commit fees (#2743)
Node operators may disable automatic fee-bumping on their local commit if
they don't have anything at stake (no pending HTLCs), which saves fees in
most cases. A drawback in that case is that if the commitment doesn't
confirm quickly enough, the remote's funds are also locked.

This can be an issue for LSPs, where the remote peer doesn't have a good
ability to fee-bump commit txs. We give more control to the node operator
by letting them fee-bump local commit txs explicitly through the RPC to
unblock wallet users funds.
2023-09-14 17:07:06 +02:00
Bastien Teinturier
948b4b91db
Don't send splice_locked before tx_signatures (#2741)
When reconnecting in the middle of signing a splice, we must ensure that
splice_locked is sent *after* tx_signatures. Otherwise when using 0-conf
we may retransmit splice_locked before tx_signatures, which our peer will
ignore because they don't have a corresponding fully signed commitment.
2023-09-13 15:40:54 +02:00
Bastien Teinturier
404e3d5ea6
Set child splices as hints in watch-funding-spent (#2734)
We start watching funding outputs once the corresponding funding transaction
has been confirmed with 3 confirmations. We may have already spent that
transaction with a child splice transaction by that time: providing hints
with the corresponding txids to the `ZmqWatcher` improves the performance
when that happens.
2023-09-11 11:01:31 +02:00
Pierre-Marie Padiou
841a8d9b19
Ignore pre-generated shutdown script when possible (#2738)
This is a follow up to #2565, more precisely to the _caveat_ here: https://github.com/ACINQ/eclair/pull/2565#issuecomment-1397052582.

We now create a fresh shutdown script even if one was already generated at channel creation, if the channel doesn't have the mandatory `option_upfront_shutdown_script` negotiated.

The (reasonable) assumption is that other implementations will ignore our pre-generated script if they didn't support the `option_upfront_shutdown_script` feature.

This "on-the-fly" approach is simpler and safer than a db migration.
2023-09-07 21:48:44 +02:00
Fabrice Drouin
3547f87f66
Use bitcoin-lib 0.29 (#2708) 2023-08-21 11:07:14 +02:00
Thomas HUET
ef25e3287a
Increase timeout for offer tests (#2725)
Increase timeout for tests that would sometime fail
2023-08-17 11:37:22 +02:00
Bastien Teinturier
42249d5ffa
Update to bitcoind 24.1 (#2711)
This lets us use the new `gettxspendingprevout` instead of fetching the
whole mempool when looking for txs spending one of our channels.

A new feature was added to bitcoind 24.1+ that tries to make the change
output indistinguishable from the payment output. This is a great for
privacy, but it adds randomness to coin selection and uses a non-minimal
set of inputs sometimes. We work around this in tests by updating the
amount of the output we want bitcoind to use to make sure it's sufficient to
pay for both the channel funding and the change output.

This shouldn't be too much of an issue for normal operation, where we'll
sometimes use two inputs instead of one, which costs more fees, but
increases privacy.

See https://github.com/bitcoin/bitcoin/pull/24494 for details.
2023-08-16 17:10:03 +02:00
Bastien Teinturier
c7e47ba751
Propagate next remote commit failed htlcs upstream (#2718)
When our peer fails HTLCs, we only propagate the failure upstream once
we've received their revocation for the previous commitment (because they
could otherwise publish the previous commitment and claim those HTLCs).

If they publish the new commitment without sending us their revocation,
we previously didn't propagate the failure upstream, which leads to an
unnecessary force-close. We now correctly handle this scenario.
2023-08-16 17:08:58 +02:00
Bastien Teinturier
4496ea77bc
Add more details to InvalidCommitmentSignatures (#2722)
This can be pretty useful when debugging splicing issues.

Fixes #2721
2023-08-10 12:23:50 +02:00
Richard Myers
47e0b83438
Add quiescence negotiation (#2680)
This change adds support for the quiescence negotiation protocol via the new `stfu` message. When a channel is quiescent, both sides will have the same set of signed htlc commitments and a splice can be performed without requiring the channel to be idle.

An additional PR is still required to update our splice implementation to properly account for in-flight htlcs. Quiescence should currently only be enabled for compatibility testing.

We send a warning and disconnect when a forbidden messages is received during quiescence; a disconnect ends quiescence. If an htlc is fulfilled/failed while quiescent, any preimage will be relayed immediately and the update will be replayed when quiescence ends.

We also send a warning and disconnect if both quiescence and splice negotiation are not complete before the quiescence timeout.

---------

Co-authored-by: t-bast <bastien@acinq.fr>
2023-07-27 11:43:31 +02:00
Bastien Teinturier
3e436114a4
Update dependencies (#2710)
* Update code dependencies

I also wanted to update logback, but I'm hitting issues because of our
custom logger in `FixtureSpec` (`LoggingEventAware` not found).

* Update build dependencies

We're now using mvn 3.9.2 to build eclair, which reports warnings in some
of the build plugins we use. Updating plugins fixes most of the warnings,
and the remaining warnings have to be fixed by the plugins themselves
to support mvn 4.x.
2023-07-13 12:41:45 +02:00
Bastien Teinturier
cf46b64905
Ignore commit_sig for aborted splice (#2709)
After exchanging `tx_complete`, we validate the splice transaction before
sending our `commit_sig`. If we consider the transaction invalid, we send
`tx_abort`. But if our peer thinks the transaction is valid, they will send
their `commit_sig`, which we must ignore until they've acked our `tx_abort`.
2023-07-10 10:39:17 +02:00
Fabrice Drouin
abf1dd3747
Fix AuditDb test (#2707)
Test assumes that payments inserted in the db will be returned in a deterministic order because they have different timestamps.
It may not always be the case if TimestampMilli.now() returns the save value twice.
So here we use explicitly different timestamps: now = TimestampMilli.now(), now + 1.milli, now + 2.milli ....
2023-07-06 10:19:18 +02:00
Bastien Teinturier
4c98e1c237
Correctly fail blinded payments after restart (#2704)
When restarting, we weren't checking whether it was using blinded paths.
If we were an intermediate node in the blinded path, we were incorrectly
returning a normal failure: it should be ok, since the introduction node
is supposed to translate those failures, but it's safer to assume that
they don't.
2023-07-03 17:29:12 +02:00
Thomas HUET
9db0063079
Record begin and end timestamps for relays (#2701)
For fighting jamming attempts, or even just to detect one, we need to know how fast relayed HTLCs are fulfilled. We now measure this and store it in the audit database. Previously the "IN" and "OUT" directions for the same HTLC were storing the same timestamp (corresponding to when the HTLC is fulfilled), we now use the timestamp at which we received the UpdateAddHtlc for the "IN" direction.
2023-06-23 13:00:23 +02:00
Pierre-Marie Padiou
1519dd07a4
Log requests for unknown channels as debug (#2700)
We can't do anything about it anyway.
2023-06-21 11:20:25 +02:00
Pierre-Marie Padiou
da98e19540
Simplify on-chain fee management (#2696)
Move away from the "block target" approach.

Get rid of the `FeeEstimator` abstraction and use an `AtomicReference` to store and update the current feerates, similar to the block count.
2023-06-20 11:56:24 +02:00
Thomas HUET
194f5dd2b8
Find route for messages (#2656)
When sending a message, the postman can now ask the router to find a route using channels only.
The same route is also used as a reply path when applicable.

The graph data structure has been updated to include both active and disabled edges.
The graph now contains features for vertices.
2023-06-19 17:01:15 +02:00
Bastien Teinturier
210b9198b3
Back to dev (#2694) 2023-06-19 11:08:09 +02:00
Bastien Teinturier
623f7e4866
Eclair v0.9.0 release (#2693) 2023-06-19 10:21:01 +02:00
Bastien Teinturier
3a351f4d5d
Never serialize ActorRef (#2697)
It turns out that #2688 broke the JSON serialization of the `channels`
API by introducing a new `ActorRef`. We never want to surface `ActorRef`
in JSON responses, so we're defining serializers to filter them out.

Co-authored-by: Fabrice Drouin <sstone@users.noreply.github.com>
2023-06-16 15:31:18 +02:00
Pierre-Marie Padiou
fe9f32bdf1
Minor updates on PeerReadyNotifier (#2695) 2023-06-14 17:06:05 +02:00
Richard Myers
303c1d45e1
Fix failing test PendingChannelsRateLimiter and clarify other tests (#2691)
---------

Co-authored-by: t-bast <bastien@acinq.fr>
2023-06-14 15:28:36 +02:00
Richard Myers
f1843178b1
Fix problems and add tests for pending channels rate limiter (#2687)
- still needs another PR to make the tests more readable
2023-06-13 16:28:14 +02:00
Bastien Teinturier
faebbfae15
Move channel collector inside Peer actor (#2688)
The `Peer` actor can now directly be queried for the list of its channels.
This makes this feature more reusable than the previous actor that was
customized for the peer-ready scenario.
2023-06-13 14:40:11 +02:00
Bastien Teinturier
05ef2f9552
Fix blinded path min_final_expiry_delta check (#2678)
The spec says that we must return an error if:

- cltv_expiry < outgoing_cltv_value
- cltv_expiry < current_block_height + min_final_cltv_expiry_delta

For the second check, we actually tested if:

- cltv_expiry < max(outgoing_cltv_value, current_block_height) + min_final_cltv_expiry_delta

But that check should only verify that our `min_final_expiry_delta`
requirement is fulfilled, which is unrelated to the `outgoing_cltv_value`.

It was redundant with the first check, which already guarantees that
intermediate nodes inside the blinded path cannot cheat by using a higher
`cltv_expiry_delta` than what the recipient intended.
2023-06-08 17:20:32 +02:00
rorp
b084d73e96
Add maxFeeMsat parameter to sendtoroute RPC call (#2626)
This ensures that routes found with `findroute*` and a max fee
are correctly ignored if we later use `sendtoroute` and the route
fee has increased.
2023-06-07 16:01:09 +02:00
Pierre-Marie Padiou
ef77198650
Ignore outgoing connection requests if front not ready (#2683)
In cluster mode, outgoing connections are initiated by frontend nodes.
If there are no frontend node available, we fail the connection attempt
with a dedicated error.

The `initial-random-reconnect-delay` should be configured to allow
enough time for the front nodes to bootstrap at reconnection.
2023-06-06 13:40:11 +02:00
Bastien Teinturier
42dfa9f535
Handle invoice with amounts larger than 1btc (#2684)
For amounts that are multiples of 1btc, we shouldn't use a multiplier
and should directly encode this amount.
2023-06-06 10:44:53 +02:00
Bastien Teinturier
5ab84712bf
Check bitcoind version before initializing DB (#2660)
When initializing the DB, we potentially run some data migration that
cannot be reverted. We want to this last, after we've checked every other
start-up requirement, such as the bitcoind version.

Fixes #2609
2023-06-02 18:24:14 +02:00
Bastien Teinturier
ef277f075e
Increase default max-cltv value (#2677)
LND and CLN already use 2016 blocks. The network is generally raising the
values of `cltv_expiry_delta` to account for high on-chain fees, so we'll
need to allow longer maximum deltas to avoid rejecting payments.
2023-06-02 13:56:17 +02:00
Bastien Teinturier
55059678c0
Make shared transaction codecs more future-proof (#2679)
When we want to add new types of inputs/outputs that contain specific
tlvs, we will need to store them alongside standard inputs/outputs.

We will use traits and case classes inside `InteractiveTxBuilder`, and
need to thus add a discriminator when encoding them.
2023-06-02 13:21:27 +02:00
Pierre-Marie Padiou
53872eaaa0
(Minor) Add json type hint for WAIT_FOR_DUAL_FUNDING_SIGNED (#2682) 2023-06-02 13:14:59 +02:00
rorp
37eb1420dc
Add closedchannels RPC (#2642)
This RPC allows to access the historic channel data without
relying on third party services like LN explorers.

Note that when the `remoteNodeId` filter is not provided, this
query may be expensive on nodes with a lot of closed channels.
2023-06-02 11:38:58 +02:00
Pierre-Marie Padiou
46d1c73889
Always store remote commit_sig in interactive tx (#2681)
In theory we don't have to store their commit_sig here, as they
would re-send it if we disconnect, but it is more consistent with
the case where we send our tx_signatures first.
2023-06-01 16:33:53 +02:00
Pierre-Marie Padiou
e7b46314cc
(Minor) refactor tlvs at connection reestablish (#2675) 2023-05-25 22:27:42 +02:00
Pierre-Marie Padiou
71968d0616
More robust channels timestamps (#2674)
Previous implementation had the advantage of being all in one place, but it left holes:
- `last_connected_timestamp` was only set after the first disconnection
- in some corner cases the `closed_timestamp` was never set (nothing at stake, funding tx timeout, post-restart)
2023-05-25 18:03:16 +02:00
Bastien Teinturier
84f1d03970
Fix splice reconnection while signing (#2673)
And add tests for splice disconnection/reconnection scenarios.
2023-05-25 17:51:10 +02:00
Bastien Teinturier
41b8d5cacd
Fix Autoprobe dummy invoice (#2661)
The autoprobe feature creates fake invoices to send payments to remote
nodes. These fake invoices must include a payment secret.

Fixes #2623
2023-05-25 15:43:56 +02:00
Bastien Teinturier
0fa44534d3
Ignore non-relayed incoming HTLCs when closing (#2672)
If we force-close with HTLCs that have just been signed by our peer but
for which we haven't received their revocation, we should ignore them.
We have not relayed those HTLCs so they can't be fulfilled. It is our
peer's responsibility to claim them on-chain (using their HTLC-timeout),
but if for some reason they don't claim it, we don't want the channel to
be stuck in the closing state.

Fixes #2669
2023-05-25 15:38:51 +02:00
Bastien Teinturier
835b33b2b8
Add upper bound on fees paid during force-close (#2668)
The on-chain feerate can be arbitrarily high, but it wouldn't make sense
to pay more fees than the amount we have at risk and need to claim
on-chain.

We compute an upper bound on the fees we'll pay and make sure we don't
exceed it, even when trying to RBF htlc transactions that get close to
their deadline.
2023-05-25 14:53:26 +02:00
Bastien Teinturier
aaad2e1d61
Accept closing fee above commit fee (#2662)
When performing a mutual close, we initially rejected fees that were
higher to the commit tx fees. This was removed from the specification
for anchor output channels, and doesn't make a lot of sense for standard
channels either: even at a higher fee, it makes sense to do a mutual
close to avoid waiting for relative delays on our outputs.

Fixes #2646
2023-05-25 13:13:12 +02:00
Bastien Teinturier
4713a541b6
Relax reserve requirements on HTLC receiver (#2666)
Bolt 2 requires the receiver of an HTLC to pay able to pay the commit tx
fee while maintaining its channel balance. This is an issue because it
can lead to a situation where the peer that has most of the channel's
funds is unable to send outgoing payments: the channel is stuck.

From the receiver's point of view, it's ok to dip into the channel reserve
as long as we're able to pay the commit tx fee, so we should accept those
HTLCs. Moreover, if those HTLCs are failed, we'll go back above our
channel reserve, and if those HTLCs are fulfilled, that will increase our
balance which guarantees we're above our channel reserve.
2023-05-25 13:12:42 +02:00
Bastien Teinturier
2c01915af0
Add message size metric (#2671)
This is interesting to perform traffic analysis on the messages we send
and receive, to inform research about traffic shaping.
2023-05-23 19:50:56 +02:00
Thomas HUET
adaad5eee6
Fix interpretation of option_onion_messages (#2670)
According to the spec, option_onion_messages signals that the node can forward onion messages which is different from being able to send or receive them (there is no feature bit for that).
We now allow nodes with this feature disabled to still receive messages and remove the NoRelay relay policy as it is redundant.
2023-05-23 19:17:39 +02:00
Bastien Teinturier
50178be6fa
Update to bitcoind 23.2 (#2664) 2023-05-22 10:04:43 +02:00
Bastien Teinturier
c73db8479c
Ignore lnd's internal errors (#2659)
It seems like lnd sends this error whenever something wrong happens on
their side, regardless of whether the channel actually needs to be closed.
We ignore it to avoid paying the cost of a channel force-close, it's up
to them to broadcast their commitment if they wish.

See https://github.com/lightningnetwork/lnd/issues/7657 for example.
2023-05-17 08:39:19 +02:00
Pierre-Marie Padiou
fa985da59f
Reject unreasonably low splice feerate (#2657)
We let the initiator pick the feerate, but it must at least meet some
sanity requirements.
2023-05-12 15:40:57 +02:00
Bastien Teinturier
55a985adc8
Fix channels DB migration (#2655)
We were missing a match on `channel_id`, which means we were rewriting
every row N times!
2023-05-11 14:42:55 +02:00
Bastien Teinturier
14cbed9b12
Fix JSON Postgres index on channel's remote_node_id (#2649)
We were creating an index on the `remote_node_id` based on the channel's
JSON serialization, which isn't very robust. The data model changes for
splicing have changed the JSON format and thus broken that index.

We now use and explicit DB column for `remote_node_id`.
2023-05-10 15:31:31 +02:00