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.
This commit is contained in:
Olaoluwa Osuntokun
2016-12-26 23:42:23 -06:00
parent 473f298524
commit c965eda29e
5 changed files with 391 additions and 171 deletions

7
log.go
View File

@ -10,6 +10,7 @@ import (
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/routing"
)
// Loggers per subsystem. Note that backendLog is a seelog logger that all of
@ -30,6 +31,7 @@ var (
utxnLog = btclog.Disabled
brarLog = btclog.Disabled
cmgrLog = btclog.Disabled
crtrLog = btclog.Disabled
)
// subsystemLoggers maps each subsystem identifier to its associated logger.
@ -46,6 +48,7 @@ var subsystemLoggers = map[string]btclog.Logger{
"UTXN": utxnLog,
"BRAR": brarLog,
"CMGR": cmgrLog,
"CRTR": crtrLog,
}
// useLogger updates the logger references for subsystemID to logger. Invalid
@ -96,6 +99,10 @@ func useLogger(subsystemID string, logger btclog.Logger) {
case "CMGR":
cmgrLog = logger
connmgr.UseLogger(logger)
case "CRTR":
crtrLog = logger
routing.UseLogger(crtrLog)
}
}