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

2216 commits

Author SHA1 Message Date
Bastien Teinturier
3e02046a52
Add logs about local channel graph inclusion (#2184)
We've seen a few reports of local channels sometimes being ignored during
path-finding (e.g. #2176).

When that happens, it's currently hard to know whether the channel is in
the graph or not: knowing that would let us know if there is a bug in the
graph management code or the path-finding algorithm itself.
2022-03-24 10:36:24 +01:00
Thomas HUET
fd84909585
Fix TLV tag number in exception (#2212) 2022-03-21 14:43:23 +01:00
Richard Myers
5af042a56a
Add messages for when startup fails due to wrong bitcoind wallet(s) loaded (#2209)
Eclair fails at startup when eclair.bitcoind.wallet is mis-configured or not loaded by bitcoind. We now show different error messages for specific failure situations and report the current wallet configuration and loaded wallets where appropriate.
2022-03-18 14:33:46 +01:00
Pierre-Marie Padiou
18ba90067e
(Minor) Fix timeout in tests (#2208)
This is a classic race condition that can appear when we register to
events in tests. We need to make sure that the subscription is taken
into account before moving forward.
2022-03-16 16:33:02 +01:00
Pierre-Marie Padiou
7b5cefaf99
Replace FeatureScope by type hierarchy (#2207)
Instead of defining a separate type `FeatureScope` with its own
hierarchy, that was then mixed in `Feature` using the cake pattern, we
go with a simpler type hierarchy for `Feature`.

This significantly simplifies type declarations (no more `Feature with
FeatureScope`) especially in the tests.
2022-03-15 16:04:20 +01:00
Richard Myers
f14300e33f
two new min-funding config parameters for public and private channels (#2203)
Add the ability to set different min-funding limits for private and public channels.
Replace min-funding-satoshis config parameter with min-public-funding-satoshis and min-private-funding-satoshis.
Show a deprecation message if min-funding-satoshis is defined.
2022-03-11 16:26:57 +01:00
Thomas HUET
8f2c93c1ab
Add delayed fees to release notes (#2204)
Add release notes for #2201
2022-03-11 10:22:27 +01:00
Richard Myers
f3c6c7885d
Do not fail to relay payments with insufficient fee rate that satisfy the previous fee rate (#2201)
Prevent relayed payments from failing due to an insufficient fee rate caused by a delay in gossip propagation with the new fee rate. Payments that satisfy the base and proportional relay fee rates from either the current or previous local channel update will not be failed during the `relay.fees.enforcement-delay` period (default 10 minutes) after the latest local fee update.

The previous fee update is only stored in memory, so after restarting the node all fee updates will be enforced immediately. To enforce a fee update with out a delay you can also issue the same update twice so that the previous and current fee rates are the same.
2022-03-08 13:25:19 +01:00
Pierre-Marie Padiou
c4f67e7495
Bump postgres-jdbc version (#2198)
See https://github.com/advisories/GHSA-673j-qm5f-xpv8. We're not vulnerable, but it doesn't cost much to update the lib.
2022-03-07 10:28:52 +01:00
Pierre-Marie Padiou
be78e0ca57
Separate htlc calculation from local/remote commit (no quicklens) (#2194)
When we know for sure that an incoming htlc will never be fulfilled, we can safely ignore it. We used to only handle htlc fulfillment. Fixes #2168.

Note that when we receive a preimage for a htlc during a local/remote force close, we need to only update the htlcs and keep the rest of `LocalCommitPublished` untouched. In particular, we don't regenerate the claim-main tx (which can cause issues if fees change), and leave the `irrevocablySpent` untouched.

Also renamed and reorganized a few helper methods.
2022-03-02 18:12:32 +01:00
Pierre-Marie Padiou
dba73c8aa4
(Minor) Flatten ChannelDataSpec tests 2022-03-02 14:39:06 +01:00
Thomas HUET
ab30af8fbc
minFinalExpiryDelta is not optional (#2195)
An invoice that doesn't explicitly set min_final_cltv_expiry has an default min_final_cltv_expiry of 18.
This default allows invoices to be slightly shorter but does not mean that the min_final_cltv_expiry can be unknown and needs to be provided from somewhere else.
2022-03-02 13:54:46 +01:00
Thomas HUET
67fb392a28
Use direct channel when available (#2192)
Because of the virtual cost per hop, a path with several "good" channels may be considered better than using a direct channel.
We remove the virtual cost for the first hop of the path to ensure that a direct channel is always selected when available.
2022-03-01 16:27:22 +01:00
Pierre-Marie Padiou
8f7c6ed68e
Refactor Closing.claimRemoteCommitMainOutput() (#2191)
Building an inconsistent intermediate `RemoteCommitPublished` object was error-prone and defeats the purpose of strong typing.

We also handle the `paysDirectlyToWallet` case directly in the method, which enables a nice factorization and better contains this now deprecated feature.
2022-03-01 13:27:17 +01:00
Richard Myers
068b1393e1
purge expired invoice at given time interval (#2174)
When Eclair first starts, search for all unpaid expired incoming payments and purge them from the payments database. These payments take up space in the database but will no longer be paid and so should be removed to improve performance and reduce the size of the database.

Purges will be triggered every 24 hours by default but can be disabled or configured with a different interval. 
The invoice purger only looks back 15 days for expired invoices when triggered after the initial scan to reduce its impact on database performance.

Co-authored-by: Thomas HUET <81159533+thomash-acinq@users.noreply.github.com>
Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2022-02-21 14:55:37 +01:00
Bastien Teinturier
b5b2022efc
Add more PR details to contributing guidelines (#2186)
* Add link to my LN articles in learning resources
* Detail pull request process
2022-02-21 08:12:42 +01:00
Bastien Teinturier
609c206a67
Ignore IBD in regtest (#2185)
When starting bitcoind on regtest, it sets the IBD flag until a few blocks
have been mined. However, this isn't a real IBD and it doesn't prevent
eclair from working at all, so we should ignore that requirement.
2022-02-17 16:30:59 +01:00
Bastien Teinturier
99aabdabd0
Add txId in logback.xml (#2183)
We changed the logging MDC key for tx-publishing in #2131, but forgot to
add a formatting rule in logback.xml for that new field, so it wasn't
written to logs.
2022-02-17 08:19:00 +01:00
Fabrice Drouin
53cb50a36e
Restrict building and publishing docker images to new pushes on master (#2182)
It is not really useful to build docker images for PRs and would not work anyway for forks that are not in the ACINQ repo.
2022-02-16 11:43:50 +01:00
Thomas HUET
92221e8409
Fix path-finding (#2172)
We used to compute the edge weight before checking that the edge could actually relay the payment.
Since #2111 we throw an exception in case `heuristicsConstants` are used and the edge can't relay the payment instead of just ignoring the edge.
We fix this by checking that the edge can relay the payment before trying to call `addEdgeWeight`.
2022-02-09 16:25:27 +01:00
Thomas HUET
66aafd6872
Better logging for NegativeProbability exception (#2171)
Show details that lead to this exception.
2022-02-09 10:49:38 +01:00
Pierre-Marie Padiou
ca71a3c152
Update a few dependencies (#2166)
This updates versions of a few major dependencies: scala, akka, postgres, etc.
2022-02-08 11:37:24 +01:00
Richard Myers
daddee1912
fixup! Convert wiki pages in to files in the docs directory and general docs file cleanups (#2165) (#2167)
- Fixup for #2165, Usage.md should link to ./API.md and not the deprecated wiki
2022-02-07 14:21:08 +01:00
Thomas HUET
9401592382
Typed features (#2164)
Give different types to init features / node announcement features / invoice features.

We now accept more invoices (we would previously reject invoices if they required a feature that we don't support but that we know is irrelevant for invoices).
2022-02-07 09:51:38 +01:00
Richard Myers
553727cb22
Convert wiki pages in to files in the docs directory and general docs file cleanups (#2165)
Created new files for pages that were in the wiki, but not already in the docs directory. Also made following fixes to  README.md and existing files in the docs directory:

* update bolt links to avoid redirect
* link to logging guide from logging section (README.md)
* fixed typo in Backup section and capitalization of Bitcoin Core (README.md)
* Alice does not need trampoline feature enabled (TrampolinePayments.md)
* link to 2021 edition of Trampoline PR (TrampolinePayments.md)
* fixed API examples and removed quotes from password (API.md)
* use --nodeIds for sendtoroute examples (TrampolinePayments.md and MultipartPayments.md)
* update CLI example 3 to use jq (Usage.md)
* fix typo in docs/FAQ.md
* updated Guide.md to point to all pages that are guides
2022-02-06 20:28:50 +01:00
Thomas HUET
fa31d81d0e
Improve postman (#2147)
Makes the code a bit cleaner and fixes a bug where `Postman` could respond with both a failure to send and later a `NoReply` after the timeout in case we were expecting a reply.
2022-02-02 17:45:22 +01:00
Thomas HUET
4307bada51
Refactoring of PaymentRequest (#2144)
Refactoring of `PaymentRequest` to pave the way for bolt12 invoices

`PaymentRequest` is renamed to `Invoice` and is now a trait extended by `Bolt11Invoice` and `Bolt12Invoice`. `Bolt12Invoice` will come in a future PR.

Co-authored-by: t-bast <bastuc@hotmail.fr>
2022-02-02 17:29:15 +01:00
Bastien Teinturier
8a65e35c8f
Don't broadcast commit before funding locked (#2163)
If a channel is force-closed before the funding transaction is confirmed,
broadcasting our local commit can be a problem if the funding
tx is double spent. When that happens, the channel stays stuck in the
closing state trying to publish a commit tx with an invalid input.

If we haven't even seen the funding tx in the mempool, we have no way of
being sure that it was double spent, so we would need to keep trying
forever, which pollutes the logs with publishing errors.

Whenever the funding transaction isn't confirmed and we have nothing
at stake, we now directly go to the closed state without publishing our
commitment. This will be an issue for peers who lost state and rely on
us for dataloss protection, but it's not worth exposing ourselves to that
annoying edge case. Our peers should be able to at least keep state
long enough for the funding tx to confirm or for them to force-close.
2022-02-02 17:28:03 +01:00
Bastien Teinturier
648f93f682
Ignore revoked htlcs after restart (#2161)
When we restart, if a downstream channel is closing with a revoked commit,
we should fail the corresponding htlcs in upstream channels.

Otherwise they will be ignored until they timeout, which will cause the
upstream channel to force-close.
2022-02-02 15:36:45 +01:00
Bastien Teinturier
cc61f121ec
Fix publish loop when funding tx double-spent (#2162)
If a funding tx is double-spent, we can't publish our commit tx. However,
the previous code would retry very regularly in a loop, polluting the logs.

When that happens, we now only retry when a new block is found.
2022-02-02 15:36:22 +01:00
Bastien Teinturier
44510698f7
Back to Dev (#2159) 2022-02-01 10:42:29 +01:00
Bastien Teinturier
a804905c0b
Eclair v0.7.0 release (#2158) 2022-02-01 08:34:50 +01:00
Pierre-Marie Padiou
0333e11c79
Database migration Sqlite->Postgres (#2156)
Add a migration tool and a step-by-step guide for users who want to switch from Sqlite to Postgres.
2022-01-31 12:49:39 +01:00
Pierre-Marie Padiou
1f6a7afd47
Have sqlite also write to jdbc url file (#2153)
Eclair will now refuse to start if the database config is changed from `sqlite` to `postgres` or the opposite.
2022-01-27 16:29:46 +01:00
Pierre-Marie Padiou
ffecd62cc1
Move channel parameters to their own conf section (#2149)
For consistency with existing sections: `router`, `relay`, `peer-connection`, etc.
2022-01-27 15:16:26 +01:00
Pierre-Marie Padiou
57c2cc5df9
Type ChannelFlags instead of using a raw Byte (#2148)
This has the same kind of impact as the typing of `Features`. In particular we can now explicitly set the values in `eclair.conf`:
`eclair.channel.channel-flags.announce-channel=true`. I took the opportunity to move this channel-related config key in its own config section, with the goal that we move the other fields in a follow-up PR.

It also has the nice side effect of providing a pretty json formatting out of the box:
```json
"channelFlags": {
  "announceChannel": true
}
```

The `open` method of the API has been updated: `channelFlags` has been replaced by a new `announceChannel` parameter.
2022-01-25 18:35:32 +01:00
Pierre-Marie Padiou
75ef66e54c
Front: use IMDSv2 to retrieve the instance ip (#2146)
This is used by the built-in AWS Beanstalk package.
2022-01-25 17:23:41 +01:00
Fabrice Drouin
8758d50df2
Update cluster documentation [ci skip] (#2122)
Update cluster documentation
2022-01-24 18:04:25 +01:00
Fabrice Drouin
f3604cffaf
Document onchain wallet backup. (#2143)
Eclair does not include an onchain wallet and instead uses the wallet of the bitcoin node it is connected to.
Users must also backup this wallet.
2022-01-24 16:32:13 +01:00
Bastien Teinturier
d59d4343c8
Improve getsentinfo accuracy (#2142)
The PaymentInitiator now stores all pending payments, where it previously
only stored trampoline payments (for which it handled the retries).

Whenever the DB doesn't contain any pending payment we also ask the
payment initiator whether a payment attempt is being started, which lets
us provide more accurate information with the `sentinfo` RPC.
2022-01-24 11:34:52 +01:00
Bastien Teinturier
2d64187073
More aggressive confirmation target when low on utxos (#2141)
An optimistic schedule for confirmation during force-close scenarios
could in theory help malicious peers starve us of our utxos, making it
hard to fee-bump HTLC transactions in high-fee environments.

If we detect that our safe utxos count is low, we try to get force-close
transactions confirmed as quickly as possible, which will yield a new utxo
that can be used to fund other transactions.
2022-01-24 11:27:45 +01:00
Bastien Teinturier
85f94554c0
Fix error logs formatting in TxPublisher (#2136)
I always forget that `log.error` doesn't use the same formatting as
other log.* methods (it optimizes for showing a Throwable).
2022-01-24 11:01:46 +01:00
Pierre-Marie Padiou
0a37213483
Add randomization on node addresses (#2123)
Instead of always using the last known peer address from the `PeersDb`,
we randomly pick the address from the `PeersDb` and the `NetworkDb`.

We use clearnet or tor addresses depending on the node configuration:
- tor not supported: always use clearnet addresses
- tor supported but not enabled for clearnet addresses: use clearnet
  addresses when available
- tor supported and enabled for clearnet addresses: use tor
  addresses when available
2022-01-21 15:24:43 +01:00
Pierre-Marie Padiou
c180ca2ef1
Postgres: add safety checks at startup (#2140)
When using postgres, at startup we optionnally run a few basic safety
checks, e.g. the number of local channels, how long since the last local
channel update, etc. The goal is to make sure that we are connected to
the correct database instance.
2022-01-21 14:45:16 +01:00
Bastien Teinturier
f8d507bbdd
Send remote address in init (#1973)
This adds the option to report a remote IP address back to a connecting
peer using the `init` message. A node can decide to use that information
to discover a potential update to its public IP address (NAT) and use
that for a `node_announcement` update message containing the new address.

See https://github.com/lightningnetwork/lightning-rfc/pull/917
2022-01-21 12:40:12 +01:00
Pierre-Marie Padiou
2f07b3ec0b
(Minor) Nits (#2139)
* consistency in feature names

Since we're not always following the `option_` prefix from the spec,
let's at least be consistent with ourselves.

* add alternative to `def nodeFees()`
2022-01-21 10:14:50 +01:00
Bastien Teinturier
e2b1b26919
Activate anchor outputs (#2134)
This feature is now ready to be widely deployed.
The transaction format has been tested for a long time
(between Phoenix iOS and our node) and automatic
fee-bumping has been implemented in #2113.
2022-01-19 13:30:55 +01:00
Bastien Teinturier
52a6ee9059
Rename TxPublishLogContext (#2131)
This data class is actually used for more than logging, we also use it to
track the id of a publish request.

We also switch to a different MDC key for transaction publishing instead
of re-using the paymentId one.
2022-01-19 13:24:22 +01:00
Bastien Teinturier
58f9ebc624
Use BlockHeight everywhere (#2129)
We now have this better type to remove ambiguity.
We should use it wherever it makes sense.
There shouldn't be any business logic change in this commit.
2022-01-19 11:31:54 +01:00
Bastien Teinturier
40f7ff4034
Replaceable txs fee bumping (#2113)
* Add deadline information to tx publication

When a channel is force-closed, we tell the `TxPublisher` the block before
which the transaction should be confirmed. Then it will be up to the
`TxPublisher` to set the feerate appropriately and fee-bump whenever
it becomes necessary.

* Evaluate feerate at tx broadcast time

We previously evaluated the feerate when we issued the command to publish
a transaction. However, the transaction may actually be published many
blocks later (especially for HTLC-timeout transactions, for which we may
issue commands long before the timeout has been reached).

We change the command to include the deadline, and evaluate the
feerate to meet that deadline when we're ready to broadcast a valid
transaction.

* Retry conflicting replaceable transactions

We should retry replaceable transactions whenever we find a conflict in
the mempool: as we get closer to the deadline, we will try higher fees.

This ensures we either succeed in replacing the mempool transaction, or
it gets confirmed before the deadline, which is good as well.

In particular, this handles the case where we restart our node. The mempool
conflict can be a transaction that we submitted ourselves, but we've
lost the context in the restart. We want to keep increasing the fees of
that transaction as we get closer to the deadline, so we need this retry
mechanism.

* Regularly bump transaction fees

Once we've published a first version of a replaceable transaction, at every
new block we evaluate whether we should RBF it.

When we choose to RBF, we try to reuse the previous wallet inputs and
simply lower the change amount. When that's not possible, we ask bitcoind
to add more wallet inputs.
2022-01-18 18:50:22 +01:00