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

1494 commits

Author SHA1 Message Date
pm47
012a58a9d6
don't preserve order in decodeShortChannelIds
It is not needed and allows us to return a `Set`, which is better suited
to how we use the result.
2018-03-14 12:57:09 +01:00
sstone
8ab3ab6fe2 Merge branch 'master' into wip-routing-sync 2018-03-13 20:14:26 +01:00
sstone
18a438b24e add timestamp-based filters for gossip messages
each peer can speficy a `timestamp range` to filter gossip messages against.
2018-03-13 18:29:17 +01:00
sstone
3900eeb2c5 update range queries type to match BOLT PR 2018-03-13 13:34:55 +01:00
Pierre-Marie Padiou
1ca7321d53
Created a type for short channel id, and other minor improvements (#480)
* type-ified `ShortChannelId`

* removed unused `listUnspent` method and test

* updated sqlite version to 3.21.0.1

* ignore `ReadAck` in `PaymentLifecycle`
2018-03-13 12:09:28 +01:00
pm47
199513b418 added back deleted filed 2018-03-13 11:35:24 +01:00
dpad85
9e953c0163 Fixed channel update comparison in TemporaryChannelFailure 2018-03-05 16:36:50 +01:00
pm47
b7e3b92dcc Merge branch 'wip-routing-sync' into wip-android-merge 2018-03-02 19:41:22 +01:00
pm47
73c86ad3e1 Merge branch 'master' into wip-routing-sync 2018-03-02 19:11:49 +01:00
Pierre-Marie Padiou
b061ea5efc Fixed bug in ignored channel computation (#472)
Also, renamed `getBlacklistedChannels` to `getIgnoredUpdates` and added
test.
2018-03-02 18:49:51 +01:00
Pierre-Marie Padiou
f0a877c78b Use bitgo API v2 to get network fees (#473)
Supports mainnet/testnet fees according to the configured chain.
2018-03-02 18:49:27 +01:00
Stadicus
86bc8761e3 Update README to work with Bitcoin Core 0.16+ (#468)
The Bitcoin Core `addwitnessaddress` rpc command is deprecated in version 0.16.0. Thus, the example `bitcoin.conf` needs to be extended to with the option `deprecatedrpc=addwitnessaddress`.

Without this change, Eclair will not be able to open new channels and the following error message will be written to eclair.log: 

```
WARN akka.actor.OneForOneStrategy akka://default/user/$h/switchboard/peer-0390b6fbf04dd277955ce454c87b270d3c910fa96ef3d78afa4bf17d3b733fb877 - addwitnessaddress is deprecated and will be fully removed in v0.17. To use addwitnessaddress in v0.16, restart bitcoind with -deprecatedrpc=addwitnessaddress. Projects should transition to using the address_type argument of getnewaddress, or option -addresstype=[bech32|p2sh-segwit] instead. (code: -32)
```
2018-03-02 17:12:56 +01:00
Pierre-Marie Padiou
bb1d0e96cf added check on to_self_delay parameter (#470) 2018-03-02 11:25:03 +01:00
Fabrice Drouin
24dadff625 Improve key management (#372)
* generate all channel keys and secrets from the node key and channel number

* use a key manager
the key manager does not export private keys or secrets.
It exports public keys, and points, and provide methods to sign
transaction.
There is just one exception: it does export revocation secrets, since
we need to send them back when we receive a commitment signature.

* key management: cache private keys and public keys

* add key manager to node parameters

* create an interface for key manager
and an implementation which keeps private keys locally

* generate a new BIP32 key path for each new channel

When we create a new channel we generate a new random BIP32 key path
with 128 bits of entropy
2018-03-01 20:37:39 +01:00
Pierre-Marie Padiou
42fb9a90c1
Reworked routing algorithm (#461)
* use a `DirectedWeightedPseudograph`

Because we want a directed graph with multiple weighted edges between two
vertices, and loops allowed.

See discussion in [1] for more details.

* take node fee into account when finding route

Fees vary depending on the amount we want to send, so as a simplification
we use a default `DEFAULT_AMOUNT_MSAT`=`10000000` to compute edges weight.

This fixes #310.

* reuse the same graph for all payments

In `findRoute`, if we have specific updates to add/remove, we don't mutate
the main graph and create a copy instead.


[1]
http://jgrapht-users.107614.n3.nabble.com/Difference-between-a-directed-multigraph-and-a-directed-pseudograph-td4024788.html
2018-03-01 19:42:23 +01:00
Pierre-Marie Padiou
85592de0e5
Proper management of expiry-related errors (#469)
Make `Commitment` return `ExpiryTooSmall` and `ExpiryTooBig` when
appropriate, and don't do the check in the `Relayer`.

Be more restrictive when sending HTLCs, so that counterparty doesn't
close the channel when a block just appeared and there is temporarily a
1-block discrepancy between two peers.

Proper management of `FinalExpiryTooSoon` in the payment handler.

On top of that, added more tests and simplified some.
2018-03-01 18:48:54 +01:00
Pierre-Marie Padiou
203288c415
Rebroadcast only valid channel_update, always attach channel_announcements (#464) 2018-03-01 17:57:52 +01:00
pm47
179e94524a Merge branch 'route-algo' into wip-android-merge 2018-03-01 14:04:24 +01:00
pm47
dc10febc31 Merge branch 'master' into wip-android-merge 2018-03-01 13:53:47 +01:00
Pierre-Marie Padiou
d510d08190 Publish a ChannelSignatureSent for each outgoing commitment sig (#467) 2018-03-01 13:53:14 +01:00
pm47
466720f8e3 more tests 2018-03-01 13:33:52 +01:00
pm47
e07e005c64 minor refactoring and better comments 2018-03-01 12:31:33 +01:00
pm47
d313c4b196 removed BidirectionalDijkstraShortestPath and fixed bugs
Apparently `BidirectionalDijkstraShortestPath` and
`DirectedWeightedPseudograph` are incompatible, which made tests fail.

There was also a bug in channel pruning when we would remove *valid*
channels from the graph.
2018-03-01 11:48:39 +01:00
pm47
ca291dfa03 Merge branch 'master' into route-algo 2018-02-28 19:35:26 +01:00
pm47
9ef8936e9e Merge branch 'master' into wip-routing-sync 2018-02-28 18:59:50 +01:00
pm47
15074797cc Merge branch 'route-algo' into wip-android-merge 2018-02-28 18:56:54 +01:00
pm47
f8f8da28f6 use a DirectedWeightedPseudograph
Because we want a directed graph with multiple weighted edges between two
vertices, and loops allowed.

See discussion in [1] for more details.

Also, followed @btcontract's suggestion of using a
`BidirectionalDijkstraShortestPath` instead of `DijkstraShortestPath`.

In `findRoute`, if we have specific updates to add/remove, we don't mutate
the main graph and create a copy instead.

[1]
http://jgrapht-users.107614.n3.nabble.com/Difference-between-a-directed-multigraph-and-a-directed-pseudograph-td4024788.html
2018-02-28 18:33:17 +01:00
pm47
30313657bd Merge branch 'channel-sig-sent' into wip-android-merge 2018-02-28 17:50:18 +01:00
pm47
8e2463716f publish a ChannelSignatureSent for each outgoing commitment sig 2018-02-28 17:47:11 +01:00
pm47
f5b7aa57ae Merge branch 'master' into wip-android-merge 2018-02-28 17:27:37 +01:00
Pierre-Marie Padiou
8d387cee90 PaymentSucceeded adds fee in amountMsat, and contains paymentHash (#466) 2018-02-28 17:26:28 +01:00
pm47
b6555b2cdb Merge branch 'wip-routing-sync' into wip-android-merge 2018-02-28 15:27:49 +01:00
pm47
643c04aa29 Merge branch 'master' into wip-android-merge 2018-02-28 15:13:12 +01:00
Pierre-Marie Padiou
43128636ce Improvements & fixes (#459)
* moved CoinUtils to eclair-core to expose conversion methods

Parsing and converting string amount to BtcAmount objects, and
displaying BtcAmount as well formatted string is a common use case.
Methods that were developed for the gui module should be exposed from
eclair-core so that they can be reused elsewhere.

* increased timeouts in integration tests

* have bitcoin wallet and watcher use a separate client

* return more information on channel opening

* removed `storedChannels` from `Peer` constructor

1) so that they can be garbage-collected
2) that was a memory leak because closed channel would stay forever

* OpenChannel now accepts a feerate param for the funding Tx

User should be able to override the fee rate of the funding tx that he
sends when he opens a channel. This custom fee is entered as a fee rate
in satoshi per byte, and converted to a fee rate per kw.

The default value of this fee rate does not change, and still aims for
the funding tx to be included in a block within the next 6 blocks,
estimation which is made through the FeeProvider class.

* reworked payment events

and made sure we send events even when `PaymentLifecycle` disappeared, e.g.
when we restart right after having sent a payment.
2018-02-27 19:36:56 +01:00
Dominique
288dec3c00
Add detailed message to remote failures (#431)
A `FailureMessage` should include a detailed description. A `transformForUser` 
static method is also added to streamline the list of failures associated to a 
`PaymentFailure`.

In the GUI, the payment notification shows a message for each failed attempts
2018-02-27 17:28:46 +01:00
pm47
9450430ac5 don't send prune channels with channel range queries 2018-02-26 20:23:03 +01:00
pm47
df52fc8ecb use SortedMap to store channel announcements 2018-02-26 20:20:22 +01:00
pm47
9f215ceda8 fixed eb162f6986 #2 2018-02-26 18:01:11 +01:00
pm47
3884932503 fixed eb162f6986 2018-02-26 18:01:11 +01:00
pm47
b0c92129f6 fixup: reformat and minor fixes 2018-02-26 17:56:58 +01:00
sstone
5ef1897176 Modify query_short_channel_id to ask for a range of ids
And not just a single id
2018-02-26 17:51:22 +01:00
sstone
d63db18473 add a new feature bit for channel queries
when we receive their init message and check their features:
- if they set `initial_routing_sync` and `channel_range_queries` we do nothing, we should receive a
range query shorly
- if they support channel range queries we send a range query
2018-02-26 17:44:40 +01:00
sstone
720d9eb45d Implement new 'routing sync' messages 2018-02-26 17:24:14 +01:00
Pierre-Marie Padiou
3b5355bbf2
Prune on initial_routing_sync (#455)
* announcements are pruned before they are sent for `initial_routing_sync` (this was removed by #422)
* is now considered stale a channel that is older than 2 weeks and hasn't any `channel_update` younger than two weeks (again, before #422 we were more lax because of pre-validation pruning)
* pruning was rewritten without use of very expensive `exists` function
* we don't prune anymore on startup
* removed `ThrottleForwarder` and `WriteAckSender`, and handle both TCP read/write backpressure at the `TransportHandler` level, which is much more efficient (e.g. we don't serialize/encrypt outgoing data if OS buffer is already full, which saves RAM and CPU)
* added a simple priority management that reduces priority of routing announcements so that they don't block channel messages on `initial_routing_sync`
2018-02-26 15:22:44 +01:00
Pierre-Marie Padiou
7aca967e91
Better closing tx management (#423)
* call `doPublish` in `handleMutualClose`

That's more consistent with other closing scenarii, and we weren't
putting a `WatchConfirmed` in case of unexpected closing tx.

* store the unsigned closing tx along with sent `closing_signed`

So that we can identify txes based on txid when they are published,
instead of on their (malleable) signature.

* don't log publish error when tx is already in blockchain

* store the last signed closing tx during negotiation

And use it instead of our local commitment if channel fails before end of
negotiation.

* fixed `SYNCING`->`NEGOTIATING` transition

There were three bugs:
(1) we weren't re-sending our `shutdown`
(2) we were re-sending all previous `closing_signed` instead of restarting
  the negotiation
(3) there was even a bug in (2) since
1aee6e8c21

On top of that, had to implement changes as per
https://github.com/lightningnetwork/lightning-rfc/pull/36.

Note that this is unfinished, as there is a corner case where fundee
reuses previous `closing_signed` to compute its next closing fee, even if
it was just disconnected for possibly a long time and network fees have
changed a lot in the meantime.

* watch for closing tx published in `OFFLINE` and `SYNCING`

* added a tx json serializer

* use a separate list for each attempted negotiation

This allow us to properly handle restarting a negotiation after a
reconnect.
2018-02-26 13:23:04 +01:00
pm47
e734834d5b reuse the same graph for all payments
The goal of this commit is to avoid recomputing a new
`DefaultDirectedWeightedGraph` for all payments.

Note that this doesn't take into account the fact that "edges between any
two vertices are <i>not</i> permitted". This is what makes tests fail.
2018-02-25 19:57:33 +01:00
pm47
c66a39ba56 take node fee into account when finding route
This is done by using a `DefaultDirectedWeightedGraph` instead of a
`DefaultDirectedGraph`.

Fees vary depending on the amount we want to send, so as a simplification
we use a default `DEFAULT_AMOUNT_MSAT`=`10000000` to compute edges weight.

This fixes #310.
2018-02-25 17:34:01 +01:00
pm47
0cbe9eed23 made findRoute use channel_updates 2018-02-25 17:04:13 +01:00
pm47
56c8e4158a added normal/low priorities for outgoing messages 2018-02-24 21:31:42 +01:00
pm47
155a14879c have bitcoin wallet and watcher use a separate client 2018-02-24 21:14:55 +01:00