Commit Graph

365 Commits

Author SHA1 Message Date
Valentine Wallace
10090a978d contractcourt/chain_arbitrator: notify the ChannelNotifier on newly closed channels. 2019-02-05 18:17:54 -08:00
Valentine Wallace
bdd8ce14c9 switch: notify the ChannelNotifier on newly active/inactive channels. 2019-02-05 18:17:54 -08:00
Valentine Wallace
5405028948 fundingmanager: inform ChannelNotifier about newly open channels. 2019-02-05 18:17:54 -08:00
Valentine Wallace
cb26fd8a17 lnd: introduce the ChannelNotifier.
This commit introduces the channel notifier which is a central source
of active, inactive, and closed channel events.

This notifier was originally intended to be used by the `SubscribeChannels`
streaming RPC call, but can be used by any subsystem that needs to be
notified on a channel becoming active, inactive or closed.

It may also be extended in the future to support other types of notifications.
2019-02-05 18:17:54 -08:00
Olaoluwa Osuntokun
1189f0ea6c
server: use chanInfo instead of chanPolicy to establish channel peer conns
In this commit, we modify the way we attempt to locate the our channel
peer to establish a persistent connection on start up. Before this
commit, we would use the channel policy pointing to the peer to locate
the node as it's embedded in the struct. However, at times it's
currently possible for the channel policy to not be found in the
database if the remote nodes announces before we finalize the process on
our end. This can at times lead to a panic as the pointer isn't checked
before attempting to access it.

To remedy this, we now instead use the channel info which will _always_
be there if the channel is known.
2019-02-03 15:01:37 -08:00
Olaoluwa Osuntokun
bceb048a76
Merge pull request #2385 from cfromknecht/peer-write-buffer
peer: write buffer pool
2019-02-01 17:04:30 -08:00
Olaoluwa Osuntokun
5167b02312
Merge pull request #2500 from Roasbeef/mandatory-dlp
server: require the DLP bit for all incoming/outgoing connections
2019-01-31 20:14:15 -08:00
Conner Fromknecht
24dcd3c44e
peer+server: use server-wide writeBufferPool for peer write buffers 2019-01-31 19:21:36 -08:00
Joost Jager
9e012ecc93
multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input
interface and implementations in a separate package along with all their
dependencies from lnwallet.
2019-01-31 13:25:33 +01:00
Conner Fromknecht
58f95322c0
server: fix notify-online log message 2019-01-23 20:40:27 -08:00
Wilmer Paulino
41f638c7cf
contractcourt+server: settle invoice for on-chain HTLC sweep
In this commit, we extend the htlcSuccessResolver to settle the invoice,
if any, of the corresponding on-chain HTLC sweep. This ensures that the
invoice state is consistent as when claiming the HTLC "off-chain".
2019-01-22 20:46:14 -08:00
Valentine Wallace
390b974793
server: set max htlc in ChannelUpdate createChannelUpdate
This method is called to convert an EdgePolicy to a ChannelUpdate. We
make sure to carry over the max_htlc value.

Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2019-01-22 08:42:29 +01:00
Valentine Wallace
0fd6004958
multi: partition lnwire.ChanUpdateFlag into ChannelFlags and MessageFlags
In this commit:

* we partition lnwire.ChanUpdateFlag into two (ChanUpdateChanFlags and
ChanUpdateMsgFlags), from a uint16 to a pair of uint8's

* we rename the ChannelUpdate.Flags to ChannelFlags and add an
additional MessageFlags field, which will be used to indicate the
presence of the optional field HtlcMaximumMsat within the ChannelUpdate.

* we partition ChannelEdgePolicy.Flags into message and channel flags.
This change corresponds to the partitioning of the ChannelUpdate's Flags
field into MessageFlags and ChannelFlags.

Co-authored-by: Johan T. Halseth <johanth@gmail.com>
2019-01-22 08:42:26 +01:00
Olaoluwa Osuntokun
c815821679
server: require the DLP bit for all incoming/outgoing connections
In this commit, we modify our default local feature bits to require the
Data Loss Protection (DLP) feature to be active. Once full Static
Channel Backups are implemented, if we connect to a peer that doesn't
follow the DLP protocol, then the SCBs are useless, as we may not be
able to recover funds. As a result, in prep for full SCB deployment,
we'll now ensure that any peer we connect to, knows of the DLP bit. This
could be a bit more relaxed and allow _connections_ to non-DLP peers,
but reject channel requests to/from them. However, this implementation is
much simpler.
2019-01-17 16:53:43 -08:00
Olaoluwa Osuntokun
b700b969e8
Merge pull request #2463 from wpaulino/notify-when-offline
server: implement notifications for disconnected peers
2019-01-15 16:47:29 -08:00
Olaoluwa Osuntokun
509bed614c
Merge pull request #2198 from Roasbeef/sendall-rpc
multi: add ability to sweep all coins in the the wallet to an addr to sendcoins
2019-01-15 14:49:17 -08:00
Wilmer Paulino
cbce6e03fc
server: implement notifications for disconnected peers 2019-01-14 22:44:45 -08:00
Conner Fromknecht
a8b2c093aa
Merge pull request #2416 from cfromknecht/netann-node-signer
netann: move NodeSigner out of main package
2019-01-09 17:01:00 -08:00
Olaoluwa Osuntokun
77262ff699 sweep: rename Estimator to FeeEstimator 2019-01-09 15:55:01 -08:00
Conner Fromknecht
32041e703b
server: replace nodeSigner in main with netann.NodeSigner 2019-01-08 16:18:39 -08:00
Johan T. Halseth
3ab01898fb
Merge pull request #2417 from cfromknecht/min-backoff
server: configurable min backoff
2019-01-08 15:07:50 +01:00
Joost Jager
c1eaf60000
invoices: create package
This commit isolates the invoice registry in a separate package. It is
a preparation for the creation of an invoices sub server.
2019-01-07 23:04:05 +01:00
Conner Fromknecht
d3b5326ae7
server: use cfg.MinBackoff instead of defaultBackoff 2019-01-04 14:05:29 -08:00
Joost Jager
74e9852e3d
utxonursery: configure using SweepInput function
As a preparation for mocking sweeper, this commit modifies the
utxonursery config to take a function pointer instead of the full
sweeper struct.
2018-12-19 12:49:19 +01:00
Joost Jager
6389a97708
utxonursery: connect to time-based sweeper
Previously, nursery generated and published its own sweep txes. It
stored the sweep tx in nursery_store to prevent a new tx with a new
sweep address from being generated on restart.

In this commit, sweep generation and publication is removed from nursery
and delegated to the sweeper. Also the confirmation notification is
received from the sweeper.
2018-12-18 10:50:20 +01:00
Olaoluwa Osuntokun
fa160f559c
multi: replace per channel sigPool with global daemon level sigPool
In this commit, we remove the per channel `sigPool` within the
`lnwallet.LightningChannel` struct. With this change, we ensure that as
the number of channels grows, the number of gouroutines idling in the
sigPool stays constant. It's the case that currently on the daemon, most
channels are likely inactive, with only a hand full actually
consistently carrying out channel updates. As a result, this change
should reduce the amount of idle CPU usage, as we have less active
goroutines in select loops.

In order to make this change, the `SigPool` itself has been publicly
exported such that outside callers can make a `SigPool` and pass it into
newly created channels. Since the sig pool now lives outside the
channel, we were also able to do away with the Stop() method on the
channel all together.

Finally, the server is the sub-system that is currently responsible for
managing the `SigPool` within lnd.
2018-12-16 15:40:14 -08:00
Igor Cota
02442ecbae Server: make maximum backoff configurable 2018-12-06 10:57:09 +01:00
Conner Fromknecht
4e48a56d5e
server: init gossiper w/ discovery.ChanSeries 2018-11-30 15:33:34 -08:00
Olaoluwa Osuntokun
1fd3aac925
multi: switch from bolt packge to bbolt package for all imports 2018-11-29 20:33:49 -08:00
ErikEk
f36c58acd7 Improved color validation - now with fixes and a table driven test 2018-11-09 03:09:39 +01:00
Olaoluwa Osuntokun
68d96488cc
server: properly set node pubkey within initTorController 2018-10-28 16:54:05 -07:00
Olaoluwa Osuntokun
0879a7354f
server: re-work initial node ann creation to use LightnignNode.NodeAnnouncement 2018-10-23 18:42:31 -07:00
Olaoluwa Osuntokun
e360005452
server: ensure we update our node ann with new tor addrs in initTorController
Fixes #1939.
2018-10-23 18:42:30 -07:00
Olaoluwa Osuntokun
338946eda4
server: update genNodeAnnouncement to also write new node ann to disk
In this commit, we update the genNodeAnnouncement method to also write
an updated version of the node announcment to disk. Before this commit,
we would update the in memory version, but then never write the new
version to disk. As a result, when connecting to new peers, we would
never propagate the new version of this announcement to the network.
2018-10-23 18:42:29 -07:00
Olaoluwa Osuntokun
fc21bf091a
multi: modify sweeper.CreateSweepTx to accept conf target, style changes
In this commit, we modify the newly introduced UtxoSweeper.CreateSweepTx
to accept the confirmation target as a param of the method rather than a
struct level variable. We do this as this allows each caller to decide
at sweep time, what the fee rate should be, rather than using a global
value that is meant to work in all scenarios. For example, anytime
we're sweeping an output with a CLTV lock that's has a dependant
transaction we need to sweep/cancel, we may require a higher fee rate
than a regular force close with a CSV output.
2018-10-18 18:08:27 -07:00
Joost Jager
c1d845aa0d
cnct: reuse sweep tx logic for commit resolver
Removes duplicate sweep tx code from commit resolver
and delegates generation to UtxoSweeper in the sweep
package.
2018-10-17 12:44:34 +02:00
Joost Jager
4dab405623
sweep: move sweep tx generation into sweep package
Sweep txes are currently generated in multiple locations. Moving
the sweep tx generation into a shared package will allow us to
reuse that logic.
2018-10-17 12:44:33 +02:00
Olaoluwa Osuntokun
13802b4218
Merge pull request #1963 from wpaulino/create-chan-buckets-once
channeldb: ensure channel buckets are only created once
2018-09-28 17:06:39 -07:00
Johan T. Halseth
addb4aed89
funding+server: make FindChannel return OpenChannel instead of LightningChannel 2018-09-28 08:59:27 +02:00
CirroStorm
f594a57c94 lnwallet: remove need for lnwallet to have access to the private key
This paves the way for lnd to work with hardware wallets, in which case it will not have access to the private key.
2018-09-27 20:58:46 -07:00
Olaoluwa Osuntokun
6afee3d099
Merge pull request #1856 from maurycy/typos
multi: fix various typos in comments
2018-09-27 20:38:10 -07:00
Joost Jager
9f6fb1e128
utxonursery: test restart behaviour 2018-09-23 15:52:45 -07:00
Wilmer Paulino
99a4952239
server+peer: check ErrEdgeNotFound when enabling/disabling a channel
In this commit, we also check ErrEdgeNotFound when attempting to send an
active/inactive channel update for a channel to the network. We do this
as it's possible that a channel has confirmed, but it still does not
meet the required number of confirmations to be publicly announced.
2018-09-21 17:24:36 -07:00
Johan T. Halseth
0a5f982280
utxonursery: pass broadcastHeight to registerPreschoolConf
In this commit IncubateOutputs are given an extra parameter
broadcastHeight, which is passed from the server and used when called
registerPresschoolConf.

Earlier the utxonursery used the bestHeight as height hint in this case,
which would be wrong in the cases where we got outputs for incubation
which was confirmed below the best height.
2018-09-20 13:16:39 +02:00
Johan T. Halseth
3a67fe2552
contractcourt+server: make IncubateOutputs take broadcastHeight 2018-09-20 12:54:48 +02:00
Wilmer Paulino
fb059ddaa5
server: start tor controller if we should listen for inbound connections
over Tor

In this commit, we fix a small bug where we would attempt to start the
Tor controller even if we were not requested to automatically create and
onion service in order to listen for inbound connections over Tor.
2018-09-14 13:45:06 -07:00
Wilmer Paulino
95560238ce
server: update to lastest tor controller api 2018-09-11 19:37:12 -07:00
maurycy
ac24b12bf2
multi: fix various typos in comments 2018-09-07 06:51:49 +02:00
Wilmer Paulino
59c404a6d3
server: ensure persistent connections to tor addrs are made if active
In this commit, we restrict the persistent connection logic on startup
to only attempt to establish connections to Tor addresses if Tor
outbound support is enabled. Otherwise, we'll continually attempt to
reach the address even though we never will.
2018-09-06 18:51:19 -07:00
Olaoluwa Osuntokun
4100dfcf6b
Merge pull request #1801 from cfromknecht/remove-initial-graph-sync-request
server: Stop requesting initial graph sync
2018-09-05 19:16:56 -07:00