* NodeURI can now handle ipv6 addresses
The address field in `NodeURI` is now a `HostAndPort` object. The reasoning is that `InetSocketAddress` is a network object and should not be directly used in an utility object. Using `HostAndPort` makes for a more readable and less bug prone code.
This especially helps with the parsing of ipv6 addresses which is more complex than ipv4. It also avoids a early lookup when the `NodeURI` object is created.
Deserialization to `NodeURI` now defaults to port 9735 if the port could not be found in the string.
fixes#343fixes#346
* reworked eclair-cli
* API is disabled by default, disabled CORS and require basic auth password
* better error handling
* Fixed latest version in README
* Increased connection timeout to 15s in electrum client test
* Rgb in NodeAnnouncement is now a Color object
Makes the color field more practical to handle and enable finer
serialization with a more readable code.
allnodes command in api now exports a list with node announcements.
* Added api call to list all the channels updates
This call can also filter the channels for a given nodeId
This fixes#344.
* added logs
* more efficient logging
* added huge bitcoin jsonrpc queue
* only publish/watch txes if needed when restarting in `CLOSING` state
* limit number of parallel routing state dump
* added a supervision strategy to authenticator hierarchy
* only forward Rebroadcast to connected peers
* rework management of `origins` in router
* explicitely close sqlite prepared statements
* fixed pruning logic
* send instead of forward announcement to router
* store txes that have reached `mindepth` in `CLOSING` state
* add a minimum 10s delay between two reconnection attempts
otherwise, this would frequently cause 2 successful parallel connections
* don't trigger a `NewBlock` event when receiving a new `WatchConfirmed`
Instead, just check this particular watch
* TransportHandler: fix typo when logging received data that has a bad prefix
* better handling of connection errors
* kill WriteAckSender when connection dies, don't send connection errors when auto connecting
* streamlined io actors
* handle parallel connections in peer
This fixes#357.
* Fix encoding of failure messages (fixes#363)
When a failure message includes a channel update field, this field must be encoded as:
[ len | channel update] and we did not include the len field.
* add `ExpiryTooFar` failure message
* always print `shortChannelId` in hex
* fixed logs in `ThrottleForwarder`
* logs the `paymentHash` when relaying an htlc
* don't print all channel data when restoring a channel
* added logs to relayer
* reduced log level in Peer
* cleaned up switchboard logs
* fixed `id`/`channelId` mixup in relayer logs
* slight changes in log levels
* do not log as warning when tx generation is simply skipped
* streamlined relayer logs
* improved router logs
* don't display errors when witness can't be parsed
* don't log connection errors as warnings
* reduce amount of logs in case of local known error
* removed reconnection message to deadletter
* try a cleaner way of displaying channel errors
* put some reconnection-related logs from info to debug
* peer: ignore `Rebroadcast` messages in `INITIALIZING`
* less verbose exception logging in channel
* display friendlier close type
* reduced default log level to INFO
Fixes#318, #317, #306
* README should recommend TESTNET
* (gui) ui can parse lightning: and lightning:// schemes
* (gui) Relaxed decimal amount regex: accepts no leading int
* (gui) Added a node info modal displaying node URI as QR code
* (gui) Logging throwable when gui can not start
* reworked peer management
- connection and channel opening are now separated, simplified
`switchboard`
- use a single authenticator for both incoming and outgoing connections
- `peers` api call now returns current state and channel count
* fixed last commit
* fixed last merge
* added inetsocketaddress serializer
* forget about channels older than 3 days and prune every minute
* Revert "forget about channels older than 3 days and prune every minute"
This reverts commit 347e01b5c18208f162b31663d383d5b7de36eea7.
* added pruning pre-validation
* don't pre-prune channels that don't have channel_update, but don't validate them either
* removed println
* removed useless handler
* cleanup announcement db at startup
* simplified pruning logic and re-enabled tests
* fix `getStaleChannels`
* fixed integration tests
* Electrum: Add unix timestamp to WalletReady notification
* Electrum: don't send WalletReady when we get disconnected
* Electrum: check that WalletReady notification is sent on reconnection
* Electrum: don't same the same ready notification more than once
We don't use state transitions to send notifications anymore
* Electrum client: use tcp keep-alive
* factorized socket options
Service pattern matching code visually separates each method and
params to improve the code readability and maintenance. Route completion
is handle on a case by case basis, for each call. This enables better error
management and useful feedback to the caller.
Added custom rejections to handle cases where the given rpc method or
params are not found or not correct.
HTTP code should now be consistent with the error returned.
* Core fee estimator: return result in satoshi per byte
It was still in satoshi per kb
* Electrum: use actual tx weight to estimate fees when funding a tx
This fixes#303
* Received payments are stored in a DB; added api calls for basic select
When the local payment handler receives a valid htlc, a Payment { payment_hash,
amount_msat, timestamp } is added in a sqlite DB. This enables the node
operator to check if a payment has been received.
Two methods are added to the JSON RPC API: list the payments and find a payment
by its payment hash.
* Test LocalPaymentHandler checking that received payment is saved in DB
* Payment API call accepts only valid paymentHash and paymentRequest arg
* API should expose only a `checkpayment` method
Interaction with payment DB from API goes through the payment handler
Also removed exception/rejection handlers to stay consistent with the api
* Updated README with checkpayment API method; moved Payment to PaymentDB
The previous assumption that a `channel_update` only exists when we have a
related `channel_announcement` does not always hold true. There are two
special cases:
- we want the `router` to know of our outgoing `channel_update` as soon as
a channel reaches `NORMAL` state, so that we can immediately send
payments
- we need to know remote's `channel_update` even for private (unannounced)
channels, in order to be able to receive funds (we will put those as
hints in the payment request using the `r` field); we also need to send
out our `channel_update` for private channels for the same reason
In order to do that, two fields were added to the `router`'s state:
- `privateChannels`: similar to `channels`, but holds a fake `channel_announcement`s for local channels that are private or are public but not yet announced
- `privateUpdates`: similar to `updates`, but holds `channel_update`s related to local channels that are private, or are public but not yet announced.
For local public channels, we will have `channel_update` both in `updates` and in `privateUpdates`, but the latter has the precedence when computing routes.
Also, in the `channel` we now handle the sending of new `channel_update` during the transitions, as opposed to in the state handlers.
Note that this changes the serialization format, making this upgrade not backward-compatible.
This fixes#244.
In commit 2e2a47e5fd we inverted the
`local`/`remote` `toSelfDelay` when building the commitment tx, but forgot
to do the same when claiming the outputs.
Updated integration tests to reproduce the issue.
This fixes#290.
The `relayer` was missing failures sent by the `channel`, which led to `htlc` lingering without being failed. Sender would see payments stuck in `PENDING` state until they eventually timeout and cause the channel to be unilaterally closed.
This is a regression caused by f47ea72369.
This fixes#264.
The `relayer` wasn't correctly handling failures from the `register`, which led to `htlc` lingering without being failed. Sender would see payments stuck in `PENDING` state until they eventually timeout and cause the channel to be unilaterally closed.
This is a regression caused by f47ea72369.
* (gui) Default unit should be milliBTC
* Default unit set to MILLI_BTC
* Added tests to String amount conversion function
* Added BTC unit
* Removed milliSatoshi unit when opening a channel
* Removed redundant dependency and added a unit test
This is a regression caused by 0794fb8d5a,
because default values provided for `git.commit.id` `git.commit.id.abbrev`
are not overriden by git-commit-id-plugin plugin.
Instead we specify these variables when doing the docker build.
* include raw tx when sig check fails
See BOLT 1 recommendation:
"when failure was caused by an invalid signature check:
SHOULD include the raw, hex-encoded transaction in reply to a
funding_created, funding_signed, closing_signed, or commitment_signed
message."
Also, removed redundant signature check in state
`WAIT_FOR_FUNDING_SIGNED`.
* enforce closing fee <= commitment fee
In accordance to BOLT 2.
Note that it is safe to consider feerates instead of fees, because
weight(closingTx) < weight(commitTx).
This fixes#243.
* use channel logger in Helpers.scala and Commitment.scala
* handle multiple closing txes
Nothing prevents the counterparty to publish any or several of the closing txes
before the negotiation is finished, we need to handle this case.
This fixes#245.
* added msg+state when chanel failure occurs
* proper handling of invalid closing sig
* removed hardcoded error messages in channel
* return an `error` to sync attemps when in CLOSING
* peer now return an error for unknown channels
* added fee negotiation details in logs
* properly display errors, reject closing fee to high
* return `UnknownNextPeer` when next channel is unknown
* correctly relay channels errors (fixes#227)
* keeping `channel_update` in DATA_NORMAL
* moved class `ForwardLocalFail`->`AddHtlcFailed`
* made `AddHtlcFailed` a `ChannelException`
* unannounced channels now return `channel_update` in errors
* use remote `htlc_minimum_msat` in `channel_update`
also set default `htlc-minimum-msat`=`10000`
This fixes#248.
* Announce short channel id when funding depth ok
* added logs to router
* channel do not send `node_announcement` anymore
Dependency to `git` has been removed, we now use `notag` when building without
a git directory.
In order to reliably fetch all dependencies, we do a first blank build
(with no source files), then we copy the sources and do a real commit.
This is a simpler and more robust approach.
Also, fixed the .dockerignore to filter out IDE files.