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

1274 Commits

Author SHA1 Message Date
n1bor
b7b9f4929a Add api call to update channel relay fees (#620)
* add api call to update channel relay fees

* fixed bug in GUI, as channel can had different fees in each direction!

* fire transitions on `TickRefreshChannelUpdate` (fixes #621)

* make router publish `channel_update`s on startup

* (gui) Channel info fees are now options and case where channels have no known fees data is now properly handled.
2018-06-19 14:09:37 +02:00
n1bor
b3731adabd Adding ability to set expiry when creating a new invoice (#632) 2018-06-19 13:13:07 +02:00
Fabrice Drouin
5afd9fa035
Add missing BOLT 2 checks (fixes #613) (#618)
* rename InvalidDustLimit to DustLimitTooSmall
* make sure that our reserve is above our dust limit
* check that their accept message is valid

see BOLT 2:
- their channel reserve must be above their dust limit
- their channel reserve must be above our dust limit
- their dust limit must be below our reserve

* channel: check to_local and to_remote amounts againt channel_reserve_satoshis

see BOLT 2: The receiving node MUST fail the channel if both to_local and to_remote amounts for
the initial commitment transaction are less than or equal to channel_reserve_satoshis (see BOLT 3).

* channel: check that their open.max_accepted_htlcs is valid
2018-06-18 19:06:14 +02:00
Fabrice Drouin
3a38c734ed
Routing: remove final CLTV expiry check on outgoing HTLCs (#627)
Checking the final CLTV expiry makes sense when we receive a payment, but
not when we're sending one
2018-06-14 10:28:45 +02:00
sstone
a85ba9ceef
set version to 0.2-SNAPSHOT 2018-05-30 19:15:06 +02:00
sstone
e6fe077582
set version to 0.2-beta4 2018-05-30 19:11:44 +02:00
Dominique
e1b884c58d Add server address in ElectrumReady object (#556)
* Added server address in ElectrumReady object

* Assigned remote address to variable to improve readability

* Checking that the master address exists in the addresses map
2018-05-30 18:53:07 +02:00
Anton Kumaigorodski
d75788039a Inform clients about incoming payments via websocket connection (#610) 2018-05-30 15:20:55 +02:00
Fabrice Drouin
3bf8db3f26
Set a minimum feerate-per-kw of 253 (fixes #602) (#608)
* set a minimum feerate-per-kw of 253 (fixes #602)

why 253 and not 250 since feerate-per-kw is feerate-per-kb / 250 and the minimum relay fee rate is 1000 satoshi/Kb ?

because bitcoin core uses neither the actual tx size in bytes or the tx weight to check fees, but a "virtual size" which is (3 * weight) / 4 ...

so we want :
fee > 1000 * virtual size
feerate-per-kw * weight > 1000 * (3 * weight / 4)
feerate_per-kw > 250 + 3000 / (4 * weight)

with a conservative minimum weight of 400, we get a minimum feerate_per-kw of 253

* set minimum fee rate to 2 satoshi/byte

users can still change it to 1 satoshi/byte

* use better weight estimations when computing fees

* test that tx fees are above min-relay-fee

* check that remote fee updates are above acceptable minimum

we need to check that their fee rate is always above our absolute minimum threshold
or we will end up with unrelayable txs

* fix ClaimHtlcSuccessTx weight computation

* channel tests: use actual minimum fee rate

test with our absolute minimum fee rate (253), it should be valid and anything below
sould be invalid and trigger and specific error
2018-05-30 13:38:40 +02:00
Fabrice Drouin
7b5b665fe9
Update electrum testnet server list, and fix flaky client pool tests (#609)
* electrum: update testnet server list

* electrum: filter out onion addresses

* electrum pool test: wait until we have a stable master server
2018-05-25 11:47:23 +02:00
araspitzu
d875007862 Fix maven version to 3.3.9 in docker build (#604)
* downgrade maven version to 3.3.9 in Dockerfile

* update java version in docker base images

Fixes #603
2018-05-22 15:54:29 +02:00
araspitzu
db43747d2b Filter out non-spendable outputs from bitcoind 'listunspent' call during setup (#605)
Fixes #599
2018-05-22 12:36:01 +02:00
pm47
644b4a2a98
back to SNAPSHOT 2018-05-18 15:53:02 +02:00
pm47
1dd8aa5aab
set version to 0.2-beta3 2018-05-18 15:14:52 +02:00
Fabrice Drouin
75437cbe81
electrum wallet: fix balance computation issue (#600)
Electrum wallet: fix balance computation issue
2018-05-18 12:58:48 +02:00
Gustavo Fernandes
f983160288 Increase startup timeout (#577) (#590) 2018-05-18 11:55:53 +02:00
Fabrice Drouin
3058ce343d
Update Sphinx test vectors (#593)
We were still using payloads with 32 bits amounts instead of 64 bits.
See https://github.com/lightningnetwork/lightning-rfc/pull/372
2018-05-18 11:55:31 +02:00
Anton Kumaigorodski
588eae93a9 Enforce min feerate per byte on regtest (#595) 2018-05-18 11:55:11 +02:00
Pierre-Marie Padiou
d95cdc5ebe
Fixed conversion: 1 BTC = 1e8 satoshis (#589)
Fixes #585
2018-05-04 18:16:30 +02:00
Pierre-Marie Padiou
d9f69bd563
Cache serialized network announcements (#588)
Because we keep sending them over and over.

Using `CacheBuilder.weakKeys` will cause the serialized messages to be
cleaned up when messages are garbage collected, hence there is no need
to set a maximum size.
2018-05-04 17:32:03 +02:00
Fabrice Drouin
d3244c8499
electrum wallet: export xpub (#586) 2018-05-04 15:06:27 +02:00
Pierre-Marie Padiou
7c12a7fecf
Check if closing tx is known before handling it (#587)
If the closing tx is already in `mutualClosePublished`, it means that we
already know about it and don't need to re-handle it again. Everytime we
succesfully negotiate a mutual close, we end up publishing ourselves the
closing tx, and right after that we are notified of this tx by the
watcher. We always ended up with duplicates in the
`mutualClosePublished`field.

This fixes #568.
2018-05-04 14:46:36 +02:00
rorp
30155f3262 Remove utxo lock when call to signrawtransaction fails (#579)
Also add `timefactor`=3 in tests.

This fixes #567.
2018-05-04 14:14:01 +02:00
Anton Kumaigorodski
e05cb6d928 Use fallbackAddress tag in PaymentRequest builder (#581) 2018-05-04 11:30:54 +02:00
Giorgio Regni
42b69585c4 Fixed \ instead of / in docker commands (acinq/eclair) (#584) 2018-05-04 10:56:45 +02:00
Anton Kumaigorodski
96e6df9df2 Add configurable min funding satoshis limit (#580)
* Add configurable min funding satoshis limit

* Update parameters
2018-05-03 14:56:07 +02:00
Fabrice Drouin
2d0564b9f8
Update bitcoin-lib to 0.9.17 (#582)
* use bitcoin-lib 0.9.17

* use Long values in BIP32 key path
2018-05-03 14:53:59 +02:00
Fabrice Drouin
bc1d995389
Retrieve and store feerate in satoshi/kB (instead of satoshi/byte) (#574)
* feerate: use satoshi/kb instead of satoshi/byte

* API fixup: convert input feerate from sat/bytes to sat/kw

* fixup: convert input feerate from sat/bytes to sat/kw

* add cleaner access to current feerate
implementation (blocks 2,6,12...) is not exposed, users will call getFeerate()

* fix feerate conversions

a kilobyte is 1000 bytes, not 1024 bytes (thanks @jimpo)

* revert commit 179dadc

keep this PR focused on 1 task only

* rename FeeratesPerKb to FeeratesPerKB
2018-04-30 19:21:52 +02:00
Gustavo Fernandes
64afc38709 Add json serializers for NodeAddress and Direction (#570)
* Enable and fix failing test (#565)

* Add json serializers for `NodeAddress` type (#565)

* Add json serializers for `Direction` type (#565)
2018-04-23 22:53:04 +02:00
Pierre-Marie Padiou
410e005703
Update local node_announcement on startup (#564)
This fixes a regression that was introduced when we stopped
re-validating all channels at startup.

Fixes #563.
2018-04-17 19:21:33 +02:00
Pierre-Marie Padiou
4db5564ada
Handle IPv4-mapped/tor2/tor3 addresses (#559)
* reproduces bug decoding ipv4-mapped-as-ipv6 addresses

* handle IPv4-mapped addresses

`InetAddress.getByAddress` automatically converted IPv4-mapped addresses
into IPv4 addresses, which resulted in them being serialized as IPv4
addresses instead of IPv6 addresses, invalidating the signature.

We now use `Inet6Address.getByAddress` instead.

* added support for parsing tor2/tor3 addresses

Note that there are currently invalid announcements on mainnet due to
https://github.com/ElementsProject/lightning/pull/1175#pullrequestreview-111994441.
2018-04-16 11:23:49 +02:00
Fabrice Drouin
6e29431b88
Update docker link (#557)
fixes #544 [ci skip]
2018-04-13 13:53:30 +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
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
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
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