lnd: set up messaging chans between peer and htlcSwitch

Each active channel now gains its a dedicated htlcManager goroutine
which currently accepts to two golang channels, and a lightning
channel. The “downstream” channel will be used for dispatched multi-hop
payments sent from the htlcSwitch, while the “upstream” channel will be
used once the readHandler de-multiplexes hltc add/timeout/settle
messages.

Each time a new channel is fully created after N confirmations, the
peer’s channelManager registers the new link with the htlcSwitch. Once
the channel is closed either cooperatively or non-cooperatively, then
the link is unregistered.
This commit is contained in:
Olaoluwa Osuntokun
2016-07-09 16:41:06 -07:00
parent 5fab6ea39e
commit 4548e4497d
2 changed files with 60 additions and 23 deletions

5
log.go
View File

@ -25,6 +25,7 @@ var (
srvrLog = btclog.Disabled
ntfnLog = btclog.Disabled
chdbLog = btclog.Disabled
hswcLog = btclog.Disabled
)
// subsystemLoggers maps each subsystem identifier to its associated logger.
@ -37,6 +38,7 @@ var subsystemLoggers = map[string]btclog.Logger{
"NTFN": ntfnLog,
"CHDB": chdbLog,
"FNDG": fndgLog,
"HSWC": hswcLog,
}
// useLogger updates the logger references for subsystemID to logger. Invalid
@ -74,6 +76,9 @@ func useLogger(subsystemID string, logger btclog.Logger) {
case "FNDG":
fndgLog = logger
case "HSWC":
hswcLog = logger
}
}