1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-03-14 11:58:19 +01:00
Commit graph

1358 commits

Author SHA1 Message Date
dpad85
9277308b2b
set version to 0.2-android-beta2 2018-04-11 17:28:36 +02:00
dpad85
bb5dcd3d4e
Merge branch 'master' into android 2018-04-11 17:10:22 +02:00
Pierre-Marie Padiou
449c307132
Support signing multiple similar/identical HTLCs (#553)
* support signing multiple identical htlcs

We previously resolved the commitment tx output based only on the
`pubkeyScript`, causing us to reuse the same output for multiple htlcs.

We now keep track of which commitment tx output has been used.

* resolve htlcs using the amount too

We may have htlcs with identical `payment_hash` + `cltv_expiry`, but
different amounts.

In that case we need to use the `amount` to differentiate and choose the
correct commitment output for each htlc.

In other cases, when there is no risk of confusion it is ok to only rely
on `pubkeyScript`.
2018-04-11 15:44:39 +02:00
Pierre-Marie Padiou
91c6645247
Correctly extract pubkeyScript from tx witness (#555)
When publishing delayed txes, we need to first watch the parent
transaction in order to know how many confirmations it has.

Electrum relies on hashes of `pubkeyScript`s in order to track
transactions.

In order to do this without having the parent transaction at hand,
we recompute the `pubkeyScript` from the child transaction witness data
and give it to Electrum.

But if the script was a `pay2wsh`, we were using the `redeemScript`
instead of computing the `pubkeyScript`.

This is the root cause of https://github.com/ACINQ/eclair-wallet/issues/17.
2018-04-11 12:01:51 +02:00
Dominique
935f138882
Resolve Electrum server address only when connecting (#554)
Electrum client should not resolve addresses when reading server list ; instead 
resolution should be made only when attempting connection.
2018-04-10 18:49:57 +02:00
pm47
b5437c9bad
back to SNAPSHOT 2018-04-04 13:52:24 +02:00
pm47
7598615263
set version to 0.2-beta2 2018-04-04 13:40:03 +02:00
pm47
0b1d28f2d9
set version to 0.2-android-beta1 2018-04-04 13:22:51 +02:00
pm47
35670424e6
Merge branch 'master' into wip-android 2018-04-03 20:42:37 +02:00
Fabrice Drouin
da3eb3b9b2
Accept bech32 addresses (#531)
* Accept bech32 addresses

Our android wallet will be able to send funds to bech32 addresses

* improve parsing of base58/bech32 addresses

Return appropriate errors when a base58 address is parseable but on the wrong chain

* add test with invalid address (not parseable as base58 or bech32)

* fix invalid version test
2018-04-03 20:35:05 +02:00
Fabrice Drouin
bafa4557dc Enforce a minimum fee rate (#530)
* Enforce a minimum fee rate, with a default at 1 satoshi/byte

Same value as bitcoin core's minimum relay fee

* add `minFeeratePerByte` to `FallbackFeeProvider`

and require that `FeeratesPerByte` and `FeeratesPerKw` be always > 0
2018-04-03 19:43:37 +02:00
Pierre-Marie Padiou
1f6d180a0c
Send channel_update once every 7 days instead of every day (#532)
In order to reduce gossip spam.
2018-04-03 19:36:01 +02:00
dpad85
1b042ecbea
Merge branch 'master' into wip-android 2018-03-29 20:21:49 +02:00
Fabrice Drouin
717eaa799f
Electrum: fix signature bug (#524)
Regression caused signature to use wrong utxo amount which means it would not be valid, and the
funding tx could not be published.
2018-03-29 20:20:39 +02:00
pm47
05a4824193
fixed e946c1a466 2018-03-29 19:32:50 +02:00
pm47
e946c1a466
Merge branch 'master' into wip-android 2018-03-29 17:09:18 +02:00
pm47
b2178ade30
back to SNAPSHOT 2018-03-28 21:27:55 +02:00
pm47
c39ce692f8
setting version to 0.2-beta1 2018-03-28 20:46:40 +02:00
Fabrice Drouin
58049a07b7
use bitcoin-lib 0.16 (#519) 2018-03-28 20:41:38 +02:00
Pierre-Marie Padiou
242f69fd6f
Add support for mainnet (#513)
* add support for mainnet final pubkeyscript

* electrum: add addresses of electrumx servers on mainnet

* electrum: use chain hash to compute addresses and HD key paths

* store db files in a subdirectory of datadir

* add a 'catchall' around deserialization

* use chain-specific key derivation paths for channel keys

* fixed intermittently failing test (we were comparing timestamps...)

* parameters:
- set default `router-broadcast-interval` to 60s
- set default `mindepth-blocks` to 3 blocks
- removed deprecated setting `router-validate-interval`
- reduce fees: block target 1->2
- reduce `MIN_CLTV_EXPIRY` from 9 to 7
Default value in BOLT11 was indeed 9 blocks, but the absolute minimum
value computed in BOLT2 is 7 blocks.
- remove unused `default-feerate-per-kb`
- set default `max-htlc-value-in-flight-msat`=10mBTC
- set default `max-to-local-delay-blocks` to 2000 blocks

* Update README with instructions for mainnet

* Upgrade to bitcoin-lib 0.9.15 (#516)

* use fees from provider, not default ones
2018-03-28 20:21:19 +02:00
Pierre-Marie Padiou
be4cf6b694
Extend penalty to stealing HTLC outputs (#517)
Previously we were only stealing the remote's main output when they publish a revoked commit, and were relying on a sufficiently high `channel_reserve` do deincentivize cheating.

In order to also steal the htlc outputs, we need to handle both cases:
- they only publish their revoked commit tx => we claim the htlc outputs directly from the commit tx
- they publish their revoked commit tx, and their 2nd-stage HTLCSuccessTx and HtlcTimeout txes => we claim the output of these htlcs tx

To do that, we need to be able to reconstruct htlc scripts (`htlcOffered` and `htlcReceived`), therefore we need to store `paymentHash` and `cltvExpiry` for each htlc we sign. Note that this won't be needed in the future when we have MAST.

* store `paymentHash` and `cltvExpiry` for each signed htlc

* spend htlc outputs with penalty txs

* added full integration tests on revoked scenario
2018-03-28 18:18:42 +02:00
S. Nizar
83d726ddb5 Update Funding tx id value in GUI when funding is signed (#511)
* Update funding tx id value upon receiving ChannelStateChanged to WAIT_FOR_FUNIDNG_CONFIRMED

Currently the only time the "Funding tx id" text in GUI is updated is
upon receiving the ChannelRestored event, which means that if the GUI is
not restarted the value keeps showing "N/A".
2018-03-28 17:27:19 +02:00
Dominique
a767aa17f3
Added json serializers to handle payment failures (#515)
Added a serializer for Throwable (local failures), and a serializer for FailureMessage (remote failures)
2018-03-27 14:06:52 +02:00
Fabrice Drouin
2a02461bcc
Upgrade to Bitcoin Core 0.16 (#514)
* switch to bitcoin core 0.16.0

* check that we are using bitcoin core 0.16

and check that there are no p2pkh UTXOs

* update readme [ci skip]
2018-03-26 20:56:51 +02:00
Pierre-Marie Padiou
e44e6b4431
Updated akka/http/json dependencies (#512) 2018-03-26 17:36:33 +02:00
pm47
e5509ed417
merge from master 2018-03-26 12:05:03 +02:00
Pierre-Marie Padiou
64c15b4c4d
Fixed race condition in ElectrumClient (#509)
This regression caused in 438d8e3 is what caused flaky tests during the past few days.

Calling `sender()` inside a `Props()` leads to undefined behavior.
2018-03-24 11:37:15 +01:00
n1bor
1a8cb2a694 Addition of API calls checkinvoice and findroute (#475)
* Add api call to check invoice/paymentRequest and return details in json

* Adding in API call to allow user to check route before making send call

* Added a serializer for route response

* Update README to include new checkinvoice and findroute API calls
2018-03-24 10:51:15 +01:00
Fabrice Drouin
ae936d56ea Use lnbcrt prefix for regtest (#508)
see https://github.com/lightningnetwork/lightning-rfc/pull/397
fixes #474
2018-03-23 22:51:02 +01:00
Fabrice Drouin
fff669662c
Use a pool of Electrum servers (#500)
add electrum router, which manages a set of client

primary client is the one on the longest chain, when a secondary client
has a chain that is longer than master + 2 it becomes the new master.
this will allow us to move away from "dead" electrum servers that are not
up to date with the blockchain.

electrum client: add 'get header' method

electrum: maintain a chain of headers for each client

and switch to the one with the longest chain

electrum: handle case when received header connects to our first header

it can happen when we connect to a server and ask for the last N headers

electrum: automatic reconnection

when we lose connection to our master client, we consider that we are
disconnected.
when we lose connection to a secondary client, we try to find an address
that is not used and connect to it. If there is no such address we wait
a bit and try to reconnect to the failing client

electrum: check that incoming header proof of work is valid

electrum router: migrate to Akka's FSM

electrum: fix match error for `ready` message

add missing copyright headers

move Blockchain to electrum package

electrum: simplify router

electrum client: fix handling of dead subscribers

electrum: move blockchain validation into electrum client

client will now send `ready` notifications and subscriptions messages only when it has a valid and
long enough blockchain

pass execution context as argument

reworked `ElectrumRouter` following
3dc1c2b61c82debeaed8d0d92238c0b5ee5c49c8

renamed `ElectrumRouter` -> `ElectrumMultiClient`

reformat

`var` -> `val`

 electrum: rename multiclient -> pool + cleanup
2018-03-23 20:41:28 +01:00
Pierre-Marie Padiou
1a37ab5613 Cleanup some TODOs (#507)
* remove useless hex methods for bitcoin tx

* re-enabled test

* `BinaryData("") -> `BinaryData.empty`

* removed invalid comment
2018-03-23 20:25:09 +01:00
Pierre-Marie Padiou
f3e32b887c
Track version of each logical database (#495) 2018-03-23 20:07:08 +01:00
Pierre-Marie Padiou
9f8cd3b580
Add json serializers to the API (#504)
* added a serializer for `UInt64` class

* added a serializer for `OutPoint` class

* use `txid` instead of `txhash` when serializing `OutPoint`

* added a simple serializer for class `InputInfo`
2018-03-23 19:33:18 +01:00
Pierre-Marie Padiou
4ef11e7e38
Added a 1s delay when API password check fails (#498) 2018-03-23 19:26:24 +01:00
Fabrice Drouin
c1777e2885 Electrum: add a send all balance method (#506) 2018-03-23 16:10:20 +01:00
Pierre-Marie Padiou
c882034f77
Set a configurable maxPaymentFee as safety (#493)
* set a configurable `maxPaymentFee` as safety

Sending a payment will not be attempted if the cheapest route found is
more expensive than this value. Default value is 3%.

This is meant as a protection mechanism, to protect against an
intermediate well-connected node to set outrageous fees.

* reduced default `fee-base-msat` to 1 sat

* (gui) using max fee from node params when sending payment from ui
2018-03-22 19:17:16 +01:00
Pierre-Marie Padiou
d38f227b42
Added copyright notice to all files (#497)
* added copyright notice to all files

* updated date in LICENSE
2018-03-21 16:29:42 +01:00
Pierre-Marie Padiou
438d8e3d4b throttle TCP writes to electrum servers (#485) 2018-03-21 10:17:05 +01:00
Fabrice Drouin
2a879f6b0c Update link to latest release (#492)
And specify that we will soon drop support for older (< 0.16) versions of Bitcoin Core
2018-03-20 17:23:34 +01:00
Fabrice Drouin
31352ceff8 Specify that we need at least jdk 1.8u161 to build (#491)
fixes #478 and supersedes #450
2018-03-20 16:40:21 +01:00
dpad85
36b0b223b0 Back to snapshot 2018-03-20 16:06:01 +01:00
pm47
ff34c49b4d increased max reconnection delay to 20s for peers and electrum servers 2018-03-20 13:32:14 +01:00
dpad85
eed7038635 set version to 0.2-android-alpha14 2018-03-20 10:48:51 +01:00
dpad85
bda9d1e356
Merge branch 'master' into wip-android 2018-03-19 20:35:09 +01:00
Pierre-Marie Padiou
e31ba2b63a
Simplified blacklisting of nodes in case of payment failures (#489)
* simplified blacklisting of nodes in case of payment failures and fixed `transformForUser`

* Add a test for PaymentLifeCycle.transformForUser()
2018-03-19 19:49:36 +01:00
pm47
25ad34ca98 reduce RAM consumption by stripping sigs after verification 2018-03-19 13:03:32 +01:00
pm47
e83a6c8a8c
Merge branch 'master' into wip-android 2018-03-19 13:03:18 +01:00
pm47
3a6cd31aa8
Merge branch 'wip-routing-sync' into wip-android 2018-03-19 13:02:24 +01:00
Pierre-Marie Padiou
ea9c005fe8
Close channel on BITCOIN_FUNDING_PUBLISH_FAILED (#487)
Implementation should guarantee that in case of a
`BITCOIN_FUNDING_PUBLISH_FAILED` event, the funding tx will *never* be
published (see `commit` method in trait `EclairWallet`).

With that in mind, there is no need for a `ERR_FUNDING_PUBLISH_FAILED`
state, instead we can just permanently close the channel. Note that the
user will receive an error "couldn't publish funding tx".
2018-03-19 12:59:48 +01:00
pm47
233548b951
Merge branch 'master' into wip-routing-sync 2018-03-19 12:58:05 +01:00