Commit Graph
35 Commits
Author SHA1 Message Date
carla 25a8773736 routing: interpret mpp timeout failues
This commit adds success mission control
results for all hops along the route in
a mpp timeout and takes no action for
the final hop along the route. This is a
temporary measure to prevent the default
logic from penalizing the final node while
we decide how to penalize mpp timeouts.
2019-12-20 13:02:30 +02:00
carla b6f546503a routerrpc: add MppTimeout code to failures 2019-12-20 13:02:19 +02:00
carla e0c86f1e71 htlcswitch+invoices: fail mpp timeouts with FailMPPTimeout
This commit adds a getResolutionFailure function
which returns an appropriate wire failure based
on the outcome of a htlc resolution. It also updates
 the MissionControlStore test to ensure that lnd
can handle failures which occur due to mpp timeout.
2019-12-20 13:02:02 +02:00
carla 1d3bb5aed6 lnwire: add FailMPPTimeout message 2019-12-20 13:01:41 +02:00
carla d2e395d5f2 multi: replace errInvoiceNotFound with resolution result
This commit moves handling of invoice not found
errors into NotifyExitHopHtlc and exposes a
resolution result to the calling functions. The
intention of this change is to make calling
functions as naive of the invoice registry's
mechanics as possible.

When NotifyExitHopHtlc is called and an invoice
is not found, calling functions can take action
based on the HtlcResolution's InvoiceNotFound
outcome rather than having to add a special error
check on every call to handle the error.
2019-12-20 13:01:15 +02:00
carla 7b5dda0417 invoices: add resolution result to htlcResolution
This commit adds the resolution result obtained
while updating an invoice in the registry to
htlcResolution. The field can be used by calling
functions to determine the outcome of the
update and act appropriately.
2019-12-20 13:00:53 +02:00
carla 273cd84355 invoices+contractcourt: add HtlcResolution constructor
This commit adds a constructor for HtlcResolution creation
to enforce provision of all relevant values when an
event is created. A custom construstor which also takes
a preimage is added for settle events.
2019-12-20 13:00:24 +02:00
carla ebfbc48973 link+contractcourt: rename processHodlEvent to processHtlcResolution 2019-12-20 12:59:56 +02:00
carla 6464f0dda0 invoices: rename event to resolution in tests 2019-12-20 12:59:33 +02:00
carla 2c44afa3a7 contractcourt: rename mock notifyEvent to notifyResolution 2019-12-20 12:59:14 +02:00
carla 2c1eb17192 mutli: rename HodlEvent to HtlcResolution
This commit renames HodlEvent to HtlcResolution
to better reflect the fact that the struct is
only used for htlc settles and cancels, and that
it is not specifically used for hodl invoices.
2019-12-20 12:58:07 +02:00
carla db85c51b77 invoices: export and rename update result
This commit exports UpdateResult so that
calling functions can interpret the outcome
of an invoice update. This is useful for
determining the wire failure required
(fail invalid details or mpp_timeout once
implemented) and for notifying specific
htlc failure details. The enum is renamed
to ResolutionResult.
2019-12-20 12:25:07 +02:00
carla eb3a2e63f2 lnrpc: display local upfront shutdown 2019-12-17 23:21:30 +02:00
carla 6eab2a06dd lnrpc+lncli: add feature bits to GetInfo 2019-12-17 23:21:14 +02:00
carla 496434259a feature: add ListSets function 2019-12-17 23:18:33 +02:00
carla c27d60b6d1 lncli: add option upfront shutdown to openchannel 2019-12-17 23:18:33 +02:00
carla a2f029caca lnrpc: add upfront shutdown address to open channel request 2019-12-17 23:18:25 +02:00
carla 3c28507062 lnrpc: Add subscribe peer events rpc 2019-12-17 21:26:55 +02:00
carla eebc23a8ad chanfitness: set open time for channels with offline peers
This commit addresses a bug in the channel event store
where the opened time of a channel event log was not
set for peers that were offline on startup.

Previously, opened time was set to the time of the first
event in the event log. This worked for online peers,
because the eventlog was created with an initial online
event. However, offline peers had no inital event so had
no open time set.

This commit simplifies the creation of an event log by
removing the initial event and setting open time for all
event logs. This has the effect of potentially introducing
a gap between opened time for a log and the first peer
online event for peers with channels that exist at startup
if a peer takes time to reconnect. However, the cost of this
is less than the benefit of reducing the bug-prone custom
code path that was previously in place.
2019-12-17 17:36:28 +02:00
carla 4f9795e8ae chanfitness: switch to query by channel outpoint
In this commit, the channelEventStore in the channel
fitness subsystem is changed to identify channels
by their outpoint rather than short channel id. This
change is made made becuase outpoints are the preferred
way to expose references over rpc, and easier to perform
queries within lnd.
2019-12-17 17:36:28 +02:00
carla 47e700ba9e rpcserver: return uptime errors for known channels
Upgrade logging of channel uptime/lifespan query errors
to returning the error, with the exception of the case
where the channel is known to the store. This error is
logged, due to the potential for race conditions between
the channel event store being notified of a new open
channel and the rpc channel subscription creating a rpc
channel struct (which queries for uptime).
2019-12-17 17:36:27 +02:00
carla ec12463a95 chanfitness: define and export ErrChannelNotFound 2019-12-17 17:36:21 +02:00
carla 94d3eb60a4 multi: Use user provided close address for cooperative closes
This commit is adapted from @Bluetegu's original
pull request #1462.

This commit reads an optional address to pay funds out to
from a user iniitiated close channel address. If the channel
already has a shutdown script set, the request will fail if
an address is provided. Otherwise, the cooperative close will
pay out to the address provided.
2019-12-10 09:13:01 +02:00
carla ef4d9334b7 lncli: Add optional delivery address to close channel
This commit is adapted from @Bluetegu's original
pull request #1462.
2019-12-10 09:13:00 +02:00
carla 9b35c349de multi: Set upfront shutdown from open and accept chanel messages
This commit gets upfront shutdown scripts from openchannel and
acceptchannel wire messages sent from our peer and sets upfront
shutdown scripts in our open and accept channel messages when
the remote peer supports option upfront shutdown and we have
the feature enabled.
2019-12-03 11:38:29 +02:00
carla 77222d8b69 channeldb: Add upfront shutdown script to OpenChannel
This commit adds fields for upfront shutdown scripts set
by the local and remote peer to the OpenChannel struct.
These values are optional, so they are added with their
own keys in the chanBucket in the DB.
2019-12-03 11:38:29 +02:00
carla f86d63144c multi: Set and check upfront shutdown address on close
This commit sets our close addresss to the address
specified by option upfront shutdown, if specified,
and disconnects from peers that fail to provide
their upfront shutdown address for coopertaive closes
of channels that were opened with the option set.
2019-12-03 11:38:29 +02:00
carla cc7accea3d mulit: Signal support for upfront shutdown
This commit enables signalling for the optional
upfront shutdown script feature bit.
2019-12-03 11:38:29 +02:00
carla 31bf542276 lnrpc: Add experimential uptime and lifetime fields to list channels
This commit adds the total observed lifetime of a channel and the
totaluptime of its remote peer to the lnrpc channel struct. These
fields are marked as experimential because they are subject to
change.
2019-10-25 11:41:16 +02:00
carla 1e86589bee chanfitness: Add channel event store
This commit adds a channel event store to the channel fitness
package which is used to manage tracking of a node's channels.
It adds tracking for channel open/closed and peer online/offline
events for all channels that a node has open.

Events are consumed from channelNotifier and peerNotifier event
subscriptions. If either of these subscriptions is cancelled,
channel scoring stops, because both subscriptions are expected
to run until node shutdown.

Two functions are exposed to allow external callers to get uptime
information about a channel. GetLifespan returns the period over
which the channel has been monitored. GetUptime returns the channel's
uptime over a specified period. Callers can use these functions to
get the channel's remote peer uptime over its entire lifetime, or
a subset of that period.
2019-10-25 09:55:09 +02:00
carla 744876003d chanfitness: Add channel event log structure
This commit adds a chanfitness package which will be used to track
channel health and performance metrics. It adds a channel event
structure which will be used to track channel opens/closes and peer
uptime.

The eventLog implements an uptime function which calcualtes uptime
over a given period and a lifespan function which returns the time
when the log began monitoring the channel and, if the channel is
closed, the time when it stopped moitoring it.
2019-10-25 09:51:07 +02:00
carla 4ceceda757 peernotifier: Add peer notifier package for peer online/offline events
This commit adds a peer notifier package which provides clients with
a subscription to peer online and offline events.
2019-08-02 10:15:28 -04:00
carla 280b28941d lnd: Add regtest exception for wait to sync on startup 2019-07-23 07:43:24 -04:00
carla d5b662d066 cmd: Add retry for password capture in create wallet 2019-07-20 14:48:25 -04:00
carla af10009c93 lnrpc: Deprecate fee field in payment struct 2019-07-09 09:58:20 -04:00