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

1529 Commits

Author SHA1 Message Date
Fabrice Drouin
064ba7df91
Backup: explicitely specify move options (#960)
* Backup: explicitely specify move options

We now specify that we want to atomically overwrite the existing backup file with the new one (fixes
a potential issue on Windows).
We also publish a specific notification when the backup process has been completed.
2019-04-23 17:11:53 +02:00
Pierre-Marie Padiou
764a1ae84c Update readme with bitcoin 0.17 instructions (#958)
This has somehow been missed by PR #826.
2019-04-23 16:50:39 +02:00
Fabrice Drouin
bed47de5e3
Live channel database backup (#951)
* Backup running channel database when needed

Every time our channel database needs to be persisted, we create a backup which is always
safe to copy even when the system is busy.

* Upgrade sqlite-jdbc to 3.27.2.1

* BackupHandler: use a specific bounded mailbox

BackupHandler is now private, users have to call BackupHandler.props() which always
specifies our custom bounded maibox.

* BackupHandler: use a specific threadpool with a single thread

* Add backup notification script

Once a new backup has been created, call an optional user defined script.
2019-04-19 22:35:12 +02:00
Pierre-Marie Padiou
c530b23175
Added simple plugin support (#927)
Using org.clapper:classutil library and a very simple `Plugin` interface.
2019-04-19 18:10:47 +02:00
Pierre-Marie Padiou
f563ca0897
Add channel errors in audit db (#955)
We now keep track of all local/remote channel errors in the audit db.
2019-04-19 16:28:02 +02:00
Andrew Camilleri
ed507334e0 Fix Dockerfile maven binary checksum (#956)
The Maven 3.6.0 SHA256 checksum was invalid and caused the docker build to fail.
2019-04-19 15:53:13 +02:00
Pierre-Marie Padiou
44778a72c9
Set MAX_BUFFERED to 1,000,000 (#948)
Note that this doesn't mean that we will buffer 1M objects in memory:
those are just pointers to (mostly) network announcements that already
exist in our routing table.

Routing table has recently gone over 100K elements (nodes,
announcements, updates) and this causes the connection to be closed when
peer requests a full initial sync.
2019-04-19 14:18:57 +02:00
Pierre-Marie Padiou
84c0fab433
Added a timeout for channel open request (#928)
Until now, if the peer is unresponsive (typically doesn't respond to
`open_channel` or `funding_created`), we waited indefinitely, or until the
connection closed.

It translated to an API timeout for users, and uncertainty about the
state of the channel.

This PR:
- adds an optional `--openTimeoutSeconds` timeout to the `open` endpoint, that will
actively cancel the channel opening if it takes too long before reaching
state `WAIT_FOR_FUNDING_CONFIRMED`.
- makes the `ask` timeout configurable per request with a new `--timeoutSeconds`
- makes the akka http timeout slightly greater than the `ask` timeout

Ask timeout is set to 30s by default.
2019-04-18 18:30:51 +02:00
Fabrice Drouin
6afe28d147
Electrum: do not persist transaction locks (#953)
Locks held on utxos that are used in unpublished funding transactions should not be persisted.
If the app is stopped before the funding transaction has been published the channel is forgotten
and so should be locks on its funding tx utxos.
2019-04-17 19:10:14 +02:00
Pierre-Marie Padiou
9032da5326
Add a proper payments database (#885)
There is no unique identifier for payments in LN protocol. Critically,
we can't use `payment_hash` as a unique id because there is no way to
ensure unicity at the protocol level.

Also, the general case for a "payment" is to be associated to multiple
`update_add_htlc`s, because of automated retries. We also routinely
retry payments, which means that the same `payment_hash` will be
conceptually linked to a list of lists of `update_add_htlc`s.

In order to address this, we introduce a payment id, which uniquely
identifies a payment, as in a set of sequential `update_add_htlc`
managed by a single `PaymentLifecycle` that ends with a `PaymentSent` or
`PaymentFailed` outcome.

We can then query the api using either `payment_id` or `payment_hash`.
The former will return a single payment status, the latter will return a
set of payment statuses, each identified by their `payment_id`.

* Add a payment identifier

* Remove InvalidPaymentHash channel exception

* Remove unused 'close' from paymentsDb

* Introduce sent_payments in PaymentDB, bump db version

* Return the UUID of the ongoing payment in /send API

* Add api to query payments by ID

* Add 'fallbackAddress' in /receive API

* Expose /paymentinfo by paymentHash

* Add id column to audit.sent table, add test for db migration

* Add invoices to payment DB

* Add license header to ExtraDirective.scala

* Respond with HTTP 404 if the corresponding invoice/paymentHash was not found.

* Left-pad numeric bolt11 tagged fields to have a number of bits multiple of five (bech32 encoding).

* Add invoices API

* Remove CheckPayment message

* GUI: consume UUID reply from payment initiator

* API: reply with JSON encoded response if the queried element wasn't found

* Return a payment request object in /receive

* Remove limit of pending payment requests!

* Avoid printing "null" fields when serializing an invoice to json

* Add index on paymentDb.sent_payments.payment_hash

* Order results in descending order in listPaymentRequest
2019-04-16 17:03:21 +02:00
rorp
70d7db7f96 Set max payment attempts from configuration (#931)
With a default to `5`.
2019-04-15 15:19:39 +02:00
araspitzu
3eceb90fa0
Expose the websocket over HTTP GET to work properly with basic auth (#934)
* Expose the websocket over HTTP GET
* Add test for basic auth over websocket endpoint
2019-04-10 11:07:19 +02:00
Fabrice Drouin
a37fd38d65
API: fix fee rate conversion (#936)
Our `open` API calls expects an optional fee rate in satoshi/byte, which is the most widely
used unit, but failed to convert to satoshi/kiloweight which is the standard in LN.
We also check that the converted fee rate cannot go below 253 satoshi/kiloweight.
2019-04-09 11:32:12 +02:00
Pierre-Marie Padiou
fa5d0235cb
Make Electrum tests pass on windows (#932)
There was an obscure Docker error when trying to start an Electrum
server in tests. [1]

It appears that there is a conflict between Docker and Hyper-V on some
range of ports.

A workaround is to just change the port we were using.

[1] https://github.com/docker/for-win/issues/3171
2019-04-04 11:38:11 +02:00
araspitzu
2aa088e0e6 Fix eclair-cli to work with equal sign in arguments (#926)
* Fix eclair cli argument passing

* Modify eclair-cli to work with equals in arguments

* Eclair-cli: show usage when wrong params are received

* Remove deprecated call from eclair-cli help message [ci skip]
2019-04-03 19:19:56 +02:00
araspitzu
3a56ad9133
Send events when HTLCs settle on-chain (#884)
* send events when htlc settle on-chain

* send events when a payment is received/relayed/sent

* send events when a payment is failed

* Add test for websocket

* Use nicer custom type hints when serializing to json (websocket)

* Fix bech32 prefix for regtest

* Separate cases for bech32 testnet and regtest for BOLT11 fallback address
2019-04-03 11:41:08 +02:00
Fabrice Drouin
288aa75305
Electrum: update client name (#930)
* Electrum: use 3.3.4 as client name

* Electrum Pool: more specific message on disconnect

Specify wether we lost connection to our master server or to a backup server.
2019-04-03 10:58:26 +02:00
Andrea
e3f8d9b140
Formatting, remove unused param in comments 2019-04-03 10:29:41 +02:00
Fabrice Drouin
617ccf4d11
Minor API fixes (#929)
Move GetInfoResponse and AuditResponse out of the api package
Fix parameter handling for audit() and networkFees()
2019-04-02 16:23:49 +02:00
Pierre-Marie Padiou
933913de08
Add random delay to rebroadcast (#925)
* add random delay to rebroadcast

* ignore `BadMessage` while disconnected

* ignore `DelayedRebroadcast` while disconnected
2019-04-01 13:31:41 +02:00
Pierre-Marie Padiou
9c37448ebf
Rollback tx if disconnected in WAIT_FOR_FUNDING_SIGNED (#923) 2019-03-30 20:28:54 +01:00
Andrea
1b91609aec
Separate cases for bech32 testnet and regtest for BOLT11 fallback address 2019-03-29 19:02:43 +01:00
Andrea
77eb1de4f3
Merge remote-tracking branch 'origin/extended-api-pm' into extended-api-pm 2019-03-29 19:00:18 +01:00
Andrea
5e476fddc4
Fix bech32 prefix for regtest 2019-03-29 18:59:59 +01:00
Fabrice Drouin
c99026828c
Electrum: fixes and improvements (#924)
* Electrum: Update mainnet servers list

* Electrum: make pool address selection more readable

We connect to a random server we're not already connected to.

* Electrum Tests: increase "wait for ready" test timeout

If was a bit short and sometimes failed on travis.

* Electrum: better parsing of invalid responses

On testnet some Electrum servers are not compliant with the protocole version they advertise
and will return responses formatted with 1.0 rules.
2019-03-29 18:56:00 +01:00
pm47
dd52cdc61f
added tests 2019-03-29 18:16:44 +01:00
araspitzu
9624383f22
cleaner isSentByLocal
Co-Authored-By: pm47 <pm47@users.noreply.github.com>
2019-03-29 18:14:32 +01:00
Pierre-Marie Padiou
14da6d3c23
Update eclair-core/src/main/scala/fr/acinq/eclair/channel/Helpers.scala
Co-Authored-By: araspitzu <a.raspitzu@protonmail.com>
2019-03-29 17:26:11 +01:00
Andrea
008b2cad87
re-introduce dropTail strategy for websocket buffer, let the unhandled messages be handled by akka's default 2019-03-29 17:09:10 +01:00
Andrea
09618a8764
Log error with warn level in websocket actor, use backpressure strategy for websocket queue. 2019-03-29 16:57:59 +01:00
Andrea
52b17fe75f
Use nicer custom type hints when serializing to json (websocket) 2019-03-28 17:54:56 +01:00
araspitzu
5bed099206
Upgrade scala library target on travis: 2.11.12 (#922) 2019-03-28 17:25:22 +01:00
Andrea
9a7e2158be
Add test for websocket 2019-03-28 16:07:51 +01:00
Andrea
c8d38871e9
remote println from test, 2019-03-28 15:21:04 +01:00
Andrea
5b423b1571
Remove 'fallbackAddress' from /receive API 2019-03-28 14:54:28 +01:00
Andrea
10bc4ab811
Reorganize specialized formats for the websocket 2019-03-28 14:51:21 +01:00
Andrea
cd703f2d4a
Merge branch 'master' into extended-api-pm 2019-03-28 11:24:12 +01:00
Andrea
c557f70af5
Finish merging master 2019-03-28 11:22:37 +01:00
Andrea
8ec8574d97
Merge branch 'master' into extended-api-pm
# Conflicts:
#	eclair-core/src/main/scala/fr/acinq/eclair/api/Service.scala
#	eclair-core/src/main/scala/fr/acinq/eclair/payment/PaymentEvents.scala
#	eclair-core/src/test/scala/fr/acinq/eclair/api/JsonSerializersSpec.scala
2019-03-28 10:44:24 +01:00
Fabrice Drouin
e2ff5c857b
Set version to 0.3-SNAPSHOT (#920)
We have enough major changes from the last release to justify switching to 0.3
2019-03-28 09:49:17 +01:00
araspitzu
2505e80283
Factor out nodeId API param, rename /channels API param to nodeId. (#919) 2019-03-27 15:49:22 +01:00
araspitzu
fafda93e5b Move the JSON API section of the readme closer to the top (#918)
Also fixed the broken link to old API documentation
2019-03-26 18:29:23 +01:00
araspitzu
a4b94004e4 API: use form data instead of JSON-RPC (#894)
Port the existing API functionalities over a new structure of HTTP endpoints, with the biggest difference being the usage of **named parameters** for the requests (responses are unchanged). RPC methods have become endpoints and the parameters for each are now passed via form-params (clients must use the header "Content-Type" : "multipart/form-data"), this allows for a clearer interpretation of the parameters and results in more elegant parsing code on the server side. It is possible to still use the old API version via a configuration key.

Old API can be used by setting `eclair.api.use-old-api=true`.
2019-03-26 18:10:09 +01:00
araspitzu
89ddc52640 Deal with channels with fees=0 when computing a route (#905)
* Treat channels with fees=0 as if they had feeBase=1msat while we compute a route

* Add test to ensure we build the onion attaching no fees if they were not required by the channel_update
2019-03-26 14:00:15 +01:00
Pierre-Marie Padiou
57e43cc65d
Check WatchSpent in constant time (#916)
This is done with a secondary map that indexes watched utxos.
2019-03-25 18:09:30 +01:00
araspitzu
06b2337ed9
Rework database initialization (#911)
* Initialize the database outside the node param constructor
* Do not create folders during StartupSpec
* Simplify syntax for instantiating test Databases
* Rework parameter passing to database initialization
* Force UTF-8 file encoding on all platform.
2019-03-25 18:04:30 +01:00
Fabrice Drouin
3b7afd92d4
Use bitcoin-lib 0.11 which embeds libsecp256k1 (#907)
* Use bitcoin-lib 0.11, which embeds libsecp256k1

* Unit tests: generate dummy sig from 32 random bytes

We now use a version of bitcoin-lib which embeds JNI bindings for libsecp256k1,
and it will only sign data that is 32 bytes long (in Bitcoin and LN you always
sign data hashes, not the actual data).

* Use maven 3.6.0 and a different mirror

* RoutingSyncSpec: don't create databases at init time

We called nodeParams which created a new in-memory sqlite database everytime we created "fake" routing info
2019-03-25 14:42:06 +01:00
Pierre-Marie Padiou
8ea4bd0468
Don't send updates if no filter has been set (#912)
We mistakenly implemented `Peer.timestampInRange` as opt-out whereas it
should be opt-in.
2019-03-25 14:37:12 +01:00
araspitzu
3fda5ddede Remove unused param 'randomize' from SendPayment command (#910)
Cleanup of the SendPayment command in which there was a leftover field 'randomize' currently replaced by its analogous in the RouteParams.
2019-03-22 14:39:06 +01:00
Fabrice Drouin
32d8a08ad1 Improve unit tests (#908)
* Bitcoin tests: generate 150 blocks instead of 500

We don't need to generate 432 blocks to activate segwit but we still need to have
spendable coins and coinbase maturity is 100 blocks even on regtest.

* Electrum client: test against mainnet Electrum servers

Previous test against testnet servers was flaky because testnet Electrum
servers are unrelable. Here we test against our own server on mainnet (and
2 servers from our list for the pool test).
2019-03-22 13:26:55 +01:00