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

1452 commits

Author SHA1 Message Date
Andrea
cecb6bcdd8
Fix help command in eclair-cli 2019-03-13 18:18:42 +01:00
Andrea
1eedeb054a
[WIP] eclair-cli 2019-03-13 16:32:19 +01:00
Andrea
8ba0e0a3a8
Adjust eclair-cli for the new APIs, output the invoice for /receive endpoint 2019-03-13 15:53:17 +01:00
Andrea
3b20d1e490
[WIP] Update eclair-cli 2019-03-13 15:28:50 +01:00
Andrea
746a5daf9a
Remove Json4s generic unmarshaller from scope 2019-03-13 15:17:29 +01:00
Andrea
af9a9691bc
[WIP] fix eclair-cli to use the new APIs 2019-03-13 13:13:01 +01:00
Andrea
7908f5e58d
Use custom http headers in all API response 2019-03-13 10:32:17 +01:00
Andrea
066634f3a2
Use HTTP POST and formParams 2019-03-13 10:16:42 +01:00
Andrea
36da70e1dc
Add configuration to enable the new APIs 2019-03-12 18:11:31 +01:00
Andrea
514cc356b7
[WIP] port to new service reorg the exception handler to make it work for real! 2019-03-12 18:03:26 +01:00
Andrea
528f195c45
[WIP] port to new service the http-basic auth 2019-03-12 17:50:58 +01:00
Andrea
1e8c2339e2
[WIP] port to new service the websocket 2019-03-12 17:44:15 +01:00
Andrea
8aebef538e
[WIP] port to new service checkpayment/audit/networkfees/channelStats 2019-03-12 17:09:07 +01:00
Andrea
848563b87a
[WIP] port to new service receive/parseinvoice/findroute/send 2019-03-12 16:11:30 +01:00
Andrea
dd909bf5c7
[WIP] port to new service allupdates calls 2019-03-12 15:00:29 +01:00
Andrea
2635e1dd0a
[WIP] port to new service more 'calls' 2019-03-12 14:36:42 +01:00
Pierre-Marie Padiou
2712e30504
Better error logs for socks5 proxy (#893) 2019-03-12 13:37:27 +01:00
Fabrice Drouin
abba9f77ec NetworkDb: remove stale channels in batch (#886)
Add methods to delete channels and tags channels as pruned in batch which is much
more efficient in sqlite.

* Network db: minor changes in unit tests

Test pruning a few 1000s channels at once.

* NetworkDb API: use Iterators and not Seq

It's more consistent with our code base.
2019-03-12 13:34:40 +01:00
Andrea
134ceeb65b
Remove swakka 2019-03-11 18:52:29 +01:00
Andrea
6bad025be3
[WIP] wire new service to api socket 2019-03-11 18:29:14 +01:00
Andrea
e148fce242
[WIP] Migrate to new API service 2019-03-11 17:32:25 +01:00
sstone
a752d65c19
BitcoinCoreWalletSpec: fix formatting issue 2019-03-06 21:25:40 +01:00
sstone
e52e385a46 Merge branch 'master' into use-bitcoin-0.17.1 2019-03-06 16:38:41 +01:00
Pierre-Marie Padiou
70397962b6
Clean channels with unexisting funding tx (#714)
There are several separate but related changes in this PR:

(a) Fast close on scenarii where we have nothing at stake (instead of going to `CLOSING` state). The previous process was not only slower (we had to wait for confirmations), but it never resolved when the funding tx hadn't been confirmed. Note that there is still an edge case where the funding tx never gets confirmed, we are fundee and we have something at stake (`push_msat` > 0).

(b) When *fundee*: after a timeout (5 days), if the funding tx hasn't reached `min_depth`, we cancel the channel.

(c) When *funder*: there is no timeout on the funding tx: however on restart, if we detect that our funding tx was doublespent, then we cancel the channel. Just because there is a doublespend doesn't mean that something malicious is going on: e.g. fee was to low, the tx was eventually removed from mempools and we just spent the inputs on something else).

Commits:

* set proper channelid in logs on restore

* fast close if we have nothing at stake

* added fundingTx and timestamp to DATA_WAIT_FOR_FUNDING_CONFIRMED

Also added migration codecs and tests

* implemented funding timeout for fundee

After a given delay, fundee will consider that the funding tx will never
confirm and cancels the channel.

Note that this doesn't apply to the funder, because our implementation
guarantees that we have sent out a funding tx, and the only way to be
sure that it will never be confirmed is that we double spend it. We just
can't rely on a timeout if we want to be safe.

* Electrum: detect if a wallet transaction has been double-spent

If it's in the mempool, or if it's been confirmed, then it's not double spent.
If it's not confirmed and not the mempool, we check if we have a transaction in
our wallet that sspends one of the inputs of our tx. If we find one, then it's been
double spent.
This will work with our funding txs, but not with their funding txs.

* fix regression with dataloss protection

The fast close causes a regression with dataloss protection, because
if we have nothing at stake we won't publish anything in case of
error (even if our peer asks us to).

This fixes #854.
2019-03-06 11:10:40 +01:00
sstone
3151360595 BitcoinCoreWallet: add signing tests with multiple bad inputs
Check that we handle errors properly when signrawtransactionwithwallet returns multiple errors.
2019-03-06 10:17:41 +01:00
sstone
de83752feb
Check that bitcoind version is 0.17.0 or higher
Plus minor code reformatting for some tests.
2019-03-03 20:35:11 +01:00
sstone
e9fb058345
Bitcoin Wallet: cleaner handling of signtransaction errors 2019-03-02 15:19:42 +01:00
sstone
fabd4d074a
Merge branch 'master' into use-bitcoin-0.17.1 2019-03-02 12:59:47 +01:00
Pierre-Marie Padiou
f9ead30b5c
Set default to-remote-delay-blocks to 720 (#879)
It sounds like a more reasonable default value, 144 was too short.

Keep using 144 blocks for our integration tests.
2019-02-25 18:00:17 +01:00
sstone
3f8f328f70 Remove unused travis files
We download bitcoin core and check with maven now.
2019-02-25 09:38:10 +01:00
sstone
e3cc72dbe4 Merge branch 'master' into use-bitcoin-0.17.1 2019-02-25 09:27:50 +01:00
araspitzu
fe31f2d9d2 Routing heuristics (#821)
* Add route-weight-ratios to SendPayment/RouteRequest

* Update test channel_update with real world fee values

* Add maxFeeBase and maxFeePct to SendCommand, use high fee tolerance in integration test

* Expose randomized route selection feature in SendPayment, used in integration test too

* Add maxCltv to SendPayment/RouteRequest

* Implement boundaries for graph searching with cost, cltv, and size

* Enable searching for routes with size/CLTV/fee limits

* Expose RouteParams in RouteRequest and SendPayment

* If we couldn't find a route on the first attempt, retry relaxing the restriction on the route size

* Avoid returning an empty path, collapse the route not found cases into one

* When retrying to search for a route, relax 'maxCltv'

* Group search params configurations into a block

* Use the returning edges in 'ignoredEdges' when looking for a spur path

* Log path-finding params when receiving a route request

* Enforce weight ratios to be between (0,1]

* Make path-finding heuristics optional
2019-02-22 18:43:20 +01:00
Dominique
32d0500ef9 Use ypub prefix for Electrum xpub (#875)
* Updated prefix of electrum xpub to upub/ypub
2019-02-21 16:25:54 +01:00
Pierre-Marie Padiou
3db7b176d3
Update jeromq dependency (#852)
* jeromq 0.4.0->0.5.0
2019-02-21 16:02:39 +01:00
Fabrice Drouin
34e51c19cc
Use OpenJDK 11 as default JDK (#846)
* Upgrade to JDK11

Eclair can be built and used on Oracle JDK 1.8 or OpenJDK 11.
JavaFX is now embedded in eclair-node-gui and does not need to be installed separately.

* Install: update java download links

OpenJDK 11 is now our recommendation. Tell users to download java from https://jdk.java.net/11

* README: Rewrite installation instructions
2019-02-21 15:11:44 +01:00
Fabrice Drouin
c0af665990 Electrum fixes and improvements (#873)
* Electrum: don't ask for merkle proofs for unconfirmed txs

* Electrum: clear status when we get disconnected and still have pending history transactions

When we get disconnected and have script hashes for which we still have pending connections,
clear the script hash status. When we reconnect we will ask for its history again, this way we
won't miss anything. Since we rotate keys it should not result in heavy traffic (script hashes have
few history items).

* Electrum: represent and persist block heights as 32 bits signed ints

Int.MaxValue is about 40,000 years of block which should be enough, and it will fix the encoding
problem users on testnet when there's a reorg and one of their txs has a height of -1.

Side-note: changing the wallet codec can be done easily: if we cannot read and decode persisted data
we just start with an empty wallet and retrieve all wallet data from electrum servers, and once it's
ready it will be encoded with the new codec and saved.

* Electrum persistence: include a version number

It provides a clean way, when upgrading the app, of choosing whether to keep the same version and start from the
last persisted wallet (if the persistence format has not been changed or is compatible with the old one), or to
change the version and force starting from an empty wallet and downloading all wallet items from Electrum servers.

* ElectrumClient: remove useless buffer
2019-02-19 11:06:36 +01:00
Pierre-Marie Padiou
aeb4360464
Fixed computation of available balance (#868)
There was a unit mismatch. Added a test.
2019-02-18 18:48:01 +01:00
Pierre-Marie Padiou
7ae083ae29
Faster gui startup (#863)
The GUI took a very long time to startup because nodes and channels were
stored in javafx `ObervableList` which doesn't allow random access. We
can't easily use `ObservableMap` because `TableView` do not support
them.

As a workaround, created an `IndexedObservableList` which keeps track of
indices in `ObservableList` so that we can still have fast random
access.

Also, now grouping announcements in `NetworkEvent` instead of sending
them one by one.
2019-02-14 15:01:19 +01:00
sstone
65bbab9bf8
Bitcoin RPC: use signrawtransactionwithwallet
We don't use `signrawtransaction` anymore, which was deprecated in Bitcoin Core 0.17
and will be removed in 0.18.

This means that we don't support 0.16.3 and older.
2019-02-13 15:38:06 +01:00
Pierre-Marie Padiou
57a9e6ed86
Support all-uppercase payment requests (#862) 2019-02-12 20:37:53 +01:00
sstone
762e48d804
Merge branch 'master' into use-bitcoin-0.17.1 2019-02-12 17:49:20 +01:00
araspitzu
efa42f5967 Make sure the path-finding algorithm can't use a channel twice in a route (#857)
* Make sure the path-finding algo can't go backward when searching
2019-02-12 15:49:19 +00:00
Pierre-Marie Padiou
e0e958320d
Using bitcoin-lib 0.9.19 (#861) 2019-02-12 16:15:32 +01:00
araspitzu
94c1c36252 Fix discrepancy between config keys (#860) 2019-02-12 10:39:23 +00:00
Pierre-Marie Padiou
884812ade0
Reimplemented BOLT 11 with scodec (#856) 2019-02-11 19:45:56 +01:00
araspitzu
4291bef88d Parametric route search (#844)
* Enable searching for routes with size/CLTV/fee limits

* Expose the RouteParams in RouteRequest

* Expose the RouteParams in SendPayment

* Rename DEFAULT_ROUTE_MAX_LENGTH

* If we couldn't find a route on the first attempt, retry relaxing the restriction on the route size

* Avoid returning an empty path, collapse the route not found cases into one

* When retrying to search for a route, relax 'maxCltv'

* Move the default params for route searching in the conf, refactor together router params into a config class

* Remove max-payment-fee in favor of router.search-max-fee-pct

* Group search params configurations into a block

* Rename config keys for router path-finding
2019-02-11 17:30:04 +00:00
Dominique
b29874ea70 Increased max-to-local-delay-blocks to 2016 (#853)
Max CLTV of 2016 agreed in 2018 Adelaide's meeting for 1.1 specs.
2019-02-08 15:11:21 +01:00
Pierre-Marie Padiou
fe48e5540c
Stop disconnected peer when it has no channels (#840)
When we are disconnected and we don't have any channel with that peer,
we can stop it and remove its address from db.

We also need to handle the case where we are in `DISCONNECTED` or
`INITIALIZING` state and we are notified that the last channel we had
with that peer just got closed.

Note that this opens a race condition in the switchboard, if we receive
an incoming connection from that same peer right after we stopped it,
and before the switchboard received the `Terminated` event. If that
happens, then `Peer.Connect` or `Peer.OpenChannel` will timeout. We
could also have the switchboard listens to deadletter events, but that
seems a bit over the top.

Also, removed switchboard's map of peers. Instead, we use the actor's 
children list, and access peers using the recommended `child()` method.
Now the 'peers request only returns an `Iterable` instead of a `Map`. This 
removes the need to watch child actors, and thus removes the race
condition when peers were stopped. As a trade-off, peer lookup is now
in O(log(N)) instead of O(1) (with N being the number of peers), but this
seems acceptable.
2019-02-08 13:29:46 +01:00
Fabrice Drouin
9f6d07ae44 Improve Electrum start-up time (#848)
Persist a partial view of our wallet to enable faster startup time.

Users will be able to create transactions as soon as we've checked that we're connected to a "good" electrum server. In the unlikely event where they were able to create and try to publish a transaction during the few seconds it took to finish syncing and their utxo was spent (because they were trying to use an unconfirmed utxo that got double spent, or if they spent their utxo themselves from another wallet initialized with the same seed  while his one was offline), publishing the tx will fail. 

* Electrum: persist wallet state

Wallet state is persisted and reloaded on startup.

* Electrum wallet: fix handling of headers chunk

When we receive a tx that is older than our checkpoints, we download and check
the header chunk that it's in, check it and connect it to our chain.

* Electrum: advertise wallet transactions

Send notifications for all wallet transactions once we're connected and synced

* Electrum: add timestamp to wallet events

Add an optional timestamp to TransactionReceived and TransactionConfidenceChanged, which is the timestamp of the block the tx was confirmed in (if any).

* Electrum client: use a Close message

This will fix concurrency issues where handlers are called when the actor
is already stopped.
2019-02-08 11:28:38 +01:00
Dominique
267037a937
Add balance and channel lifecycle events to the audit db (#827)
Note that balance events are logged at most once every 30s, and only when
the balance actually changes (e.g. won't log if a payment is failed).

Also, only send `AvailableBalanceChanged` when needed.

We were sending this event everytime we sent a `commit_sig`, which is
incorrect because our balance doesn't change if, say, we are signing an
incoming htlc.

Note that we only send this event in `NORMAL` state, not in `SHUTDOWN`
state, because the balance is not really _available_ in the latter.
2019-02-08 10:41:09 +01:00