Commit Graph

55 Commits

Author SHA1 Message Date
Oliver Gugger
bc3909050e
multi: rename and export logWriter as RootLogWriter 2020-05-14 14:37:50 +02:00
Conner Fromknecht
a25269c4d3
lnrpc/verrpc: add Versioner RPC server 2020-04-10 16:39:23 -07:00
Joost Jager
9f1720dea8
build: prevent loggers from overwriting each other.
Previously only the last registered logger would receive debug level
changes.
2019-12-11 15:22:00 +01:00
Joost Jager
74c2df658e
localchans: log policy update error 2019-12-11 00:17:06 +01:00
Joost Jager
f289dbd826
routing: define subsystem constant 2019-12-11 00:17:04 +01:00
Olaoluwa Osuntokun
d422ebbc66
lnwallet/chanfunding: introduce new channel funding abstractions
In this commit, we introduce a series of new abstractions for channel
funding. The end goal is to enable uses cases that construct the funding
transaction externally, eventually handing the funding outpoint to lnd.
An example of such a use case includes channel factories and external
channel funding using a hardware wallet.

We also add a new chanfunding.Assembler meant to allow external channel
funding in contexts similar to how channel factories
can be constructed. With this channel funder, we'll only obtain the
channel point and funding output from it, as this alone is enough to
carry out a funding flow as normal.
2019-12-02 17:11:32 -06: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
Oliver Gugger
94f49192cf
lnd: refactor sub logger setup to use new rotating log writer 2019-10-14 14:56:31 +02:00
Oliver Gugger
d3995a73ae
build: move log rotator code 2019-10-14 14:56:31 +02:00
Olaoluwa Osuntokun
ed954785b2
rpc: add unary+streaming interceptors to log all errors
Not all errors that occur when serving client requests in the gRPC
server are logged. As a result, at times, we can be lacking critic
information that can be used to debug issues that pop up. With this PR,
we create a basic streaming+unary interceptor that will log all errors
that occur when servicing calls.

The current format looks something like this in the logs when an error
occurs:

```
[ERR] RPCS: [/lnrpc.Lightning/SendCoins]: decoded address is of unknown format
```
2019-08-06 19:41:41 -07:00
Olaoluwa Osuntokun
e44445e952
Merge pull request #3354 from carlaKC/peernotify-addpeernotifierservice
Peernotifier: Add Peer Notifier package
2019-08-06 19:34:25 -07:00
Johan T. Halseth
74f0c5f00f
log: correct NTFR -> ntfrLog mapping
Most likely because of a typo, NTFR was mapping to ntfnLog instead of
ntfrLog.

Originally added in 59e2be5306a77fff24bf2e8be1ba335247ef5beb
2019-08-05 15:21:59 +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
Wilmer Paulino
8f010abac5
multi: add watchtower client RPC subserver 2019-07-30 15:18:15 -07:00
Conner Fromknecht
5266f597fd
log: add watchtower client logs 2019-06-13 19:54:18 -07:00
Valentine Wallace
f5eeb05e0a
rpcserver+monitoring/config: enable Prometheus monitoring.
Start the Prometheus exporter in rpcserver.go if monitoring is enabled through the
build tag. Also allow users to specify what address they want the Prometheus
exporter to be listening on.
2019-06-11 11:26:09 -07:00
Johan T. Halseth
b53899c43c
lnd: rename package main->lnd 2019-04-23 20:57:33 +02:00
Olaoluwa Osuntokun
056decac2a
log: hook up chanbackup logger 2019-03-28 17:53:34 -07:00
Joost Jager
6b6dd30aa7
routerrpc: register router sub server logger 2019-03-27 11:44:49 +01: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
Joost Jager
3545685177
invoicesrpc: create sub server
Sub server implementation is still empty. This is a preparatory
step for adding invoice functionality.
2019-02-01 09:42:35 +01:00
Wilmer Paulino
59e2be5306
config: add ChainRPC config 2019-01-21 14:02:00 -08:00
Conner Fromknecht
e0c652791b
log: add watchtower logs 2019-01-14 19:42:33 -08:00
Conner Fromknecht
97f4f10355
log: initialize NANN logger for netann pkg 2019-01-09 13:31:39 -08: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
Johan T. Halseth
00376230ff
lnrpc+log: add autopilot rpc logger 2018-12-13 12:33:44 +01:00
Olaoluwa Osuntokun
844698048a
log: wire up the new WalletKit logger 2018-12-06 16:25:37 -08:00
Olaoluwa Osuntokun
16d16cf1b6
log: register logger for new Signer RPC Service, namespace SGNR 2018-11-28 20:57:04 -08: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
Conner Fromknecht
bfcda6e205
log: initialize subloggers w/ build.LogWriter
and build.NewSubLogger
2018-10-05 13:04:45 +09:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Conner Fromknecht
aaf0c228d5
log: pass LTND subsystem logger to signal pkg 2018-06-28 16:17:02 -07:00
vegardengen
5eed171187 config: make log rotation configurable 2018-04-06 15:11:42 -07:00
Olaoluwa Osuntokun
4ced071a7d
cmd/lncli+log: fix linter error 2018-03-13 13:01:21 -07:00
Olaoluwa Osuntokun
813902ddeb
log: hook up the logger for the sphinx package
With this logger in place, we’ll properly get log updates whenever a
set of shared secrets is to be garbage collected.
2018-03-13 12:59:14 -07:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
Olaoluwa Osuntokun
24a16b4f49
lnd: properly initialize entities of new contractcourt package 2018-01-22 19:19:42 -08:00
Olaoluwa Osuntokun
ba5ed9e8d2
log: add logger for the autopilot package 2017-08-10 21:39:47 -07:00
Olaoluwa Osuntokun
a73589f3e9
lnd: properly initialize LightningWallet with new config 2017-07-30 17:52:07 -07:00
Olaoluwa Osuntokun
497b522c13
lnd: update logging interaction to latest API changes 2017-07-06 14:37:02 -07:00
Andrey Samokhvalov
8fa2b95c12 lnd: remove seelog logger
The btclog package has been changed to defining its own logging
interface (rather than seelog's) and provides a default implementation
for callers to use.

There are two primary advantages to the new logger implementation.

First, all log messages are created before the call returns.  Compared
to seelog, this prevents data races when mutable variables are logged.

Second, the new logger does not implement any kind of artifical rate
limiting (what seelog refers to as "adaptive logging").  Log messages
are outputted as soon as possible and the application will appear to
perform much better when watching standard output.

Because log rotation is not a feature of the btclog logging
implementation, it is handled by the main package by importing a file
rotation package that provides an io.Reader interface for creating
output to a rotating file output.  The rotator has been configured
with the same defaults that btcd previously used in the seelog config
(10MB file limits with maximum of 3 rolls) but now compresses newly
created roll files.  Due to the high compressibility of log text, the
compressed files typically reduce to around 15-30% of the original
10MB file.
2017-06-25 14:19:56 +01:00
Olaoluwa Osuntokun
7283befe2a
log: add logger for new light client 2017-06-05 18:43:55 -07:00
Andrey Samokhvalov
c4955258f1 htlcswicth: start use htlcswitch and channel link inside lnd
In current commit big shift have been made in direction of unit testable
payments scenarios. Previosly two additional structures have been added
which had been spreaded in the lnd package before, and now we apply
them in the lnd itself:

1. ChannelLink - is an interface which represents the subsystem for
managing the incoming htlc requests, applying the changes to the
channel, and also propagating/forwarding it to htlc switch.

2. Switch - is a central messaging bus for all incoming/outgoing htlc's.
The goal of the switch is forward the incoming/outgoing htlc messages
from one channel to another, and also propagate the settle/fail htlc
messages back to original requester.

With this abtractions the folowing schema becomes nearly complete:

abstraction
    ^
    |
    | - - - - - - - - - - - - Lightning - - - - - - - - - - - - -
    |
    | (Switch)		        (Switch)		  (Switch)
    |  Alice <-- channel link --> Bob <-- channel link --> Carol
    |
    | - - - - - - - - - - - - - TCP - - - - - - - - - - - - - - -
    |
    |  (Peer) 		        (Peer)	                  (Peer)
    |  Alice <----- tcp conn --> Bob <---- tcp conn -----> Carol
2017-05-31 11:06:08 -07:00
Andrey Samokhvalov
b4ac7071ff discovery+routing: split 'routing' package on 'routing' and 'discovery'
In this commit the routing package was divided on two separete one,
this was done because 'routing' package start take too much responsibily
on themself, so with following commit:

Routing pacakge:
Enitites:
* channeldb.ChannelEdge
* channeldb.ChannelPolicy
* channeldb.NodeLightning

Responsibilities:
* send topology notification
* find payment paths
* send payment
* apply topology changes to the graph
* prune graph
* validate that funding point exist and corresponds to given one
* to be the source of topology data

Discovery package:
Entities:
* lnwire.AnnounceSignature
* lnwire.ChannelAnnouncement
* lnwire.NodeAnnouncement
* lnwire.ChannelUpdateAnnouncement

Responsibilities:
* validate announcement signatures
* sync topology with newly connected peers
* handle the premature annoucement
* redirect topology changes to the router susbsystem
* broadcast announcement to the rest of the network
* exchange channel announcement proofs

Before that moment all that was in the 'routing' which is quite big for
one subsystem.

split
2017-03-29 19:49:05 -07:00
Trevin Hofmann
40c7bac3aa multi: fix a variety of typos throughout the repo 2017-01-17 17:02:56 -08:00
Olaoluwa Osuntokun
3741ae1d4c
lnd: fix lingering connmgr import 2017-01-05 14:08:36 -08:00
Olaoluwa Osuntokun
c965eda29e
lnd: fully integrate the ChannelRouter of the new routing package
This commit fully integrates the ChannelRouter of the new routing
package into the main lnd daemon.

A number of changes have been made to properly support the new
authenticated gossiping scheme.

Two new messages have been added to the server which allow outside
services to: send a message to all peers possible excluding one, and
send a series of messages to a single peer. These two new capabilities
are used by the ChannelRouter to gossip new accepted announcements and
also to synchronize graph state with a new peer on initial connect.

The switch no longer needs a pointer to the routing state machine as it
no longer needs to report when channels closed since the channel
closures will be detected by the ChannelRouter during graph pruning
when a new block comes in.

Finally, the funding manager now crafts the proper authenticated
announcement to send to the ChannelRouter once a new channel has bene
fully confirmed. As a place holder we have fake signatures everywhere
since we don’t properly store the funding keys and haven’t yet adapted
the Signer interface (or create a new one) that abstracts out the
process of signing a generic interface.
2016-12-27 16:44:31 -08:00
Olaoluwa Osuntokun
bd89a9312d
lnd: switch to using the connmgr for listening and persistent conns
This commit revamps the way in bound and outbound connections are
handled within lnd. Instead of manually managing listening goroutines
and also outbound connections, all the duty is now assigned to the
connmgr, a new btcsuite package.

The connmgr now handles accepting inbound (brontide) connections and
communicates with the server to hand off new connections via a
callback. Additionally, any outbound connection attempt is now made
persistent by default, with the assumption that (for right now),
connections are only to be made to peers we wish to make connections
to. Finally, on start-up we now attempt to connection to all/any of our
direct channel counter parties in order to promote the availability of
our channels to the daemon itself and any RPC users.
2016-12-14 18:15:55 -08:00
Olaoluwa Osuntokun
494fcec874
breacharbiter: introduce new sub-system to watch for breaches
This commit introduces a new sub-system into the daemon whose job it is
to vigilantly watch for any potential channel breaches throughout the
up-time of the daemon. The logic which was moved from the utxoNursery
in a prior commit now resides within the breachArbiter.

Upon start-up the breachArbiter will query the database for all active
channels, launching a goroutine for each channel in order to be able to
take action if a channel breach is detected. The breachArbiter is also
responsible for notifying the htlcSwitch about channel breaches in
order to black-list the breached linked during any multi-hop forwarding
decisions.
2016-11-28 19:44:09 -08:00
Olaoluwa Osuntokun
bfa2a1d698
lnd: introduce the utxoNursery which incubates outputs until maturity
This commit introduces the utxoNursery. The duty of the utxoNursery is
to watch over CSV-locked immature outputs until they’ve fully matured.
An output is mature once both its sequence lock indicated by the CSV op
code within its output has become active. Once an output is mature the
nursery sweeps the outputs in batches into the source wallet.

The utxoNursery executes its duties once a commitment transaction has
been broadcast on-chain.
2016-09-12 19:07:39 -07:00