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.
This commit is contained in:
Olaoluwa Osuntokun
2016-11-28 19:43:57 -08:00
parent 93cbfdbd60
commit 494fcec874
10 changed files with 593 additions and 43 deletions

6
log.go
View File

@ -27,6 +27,7 @@ var (
chdbLog = btclog.Disabled
hswcLog = btclog.Disabled
utxnLog = btclog.Disabled
brarLog = btclog.Disabled
)
// subsystemLoggers maps each subsystem identifier to its associated logger.
@ -41,6 +42,7 @@ var subsystemLoggers = map[string]btclog.Logger{
"FNDG": fndgLog,
"HSWC": hswcLog,
"UTXN": utxnLog,
"BRAR": brarLog,
}
// useLogger updates the logger references for subsystemID to logger. Invalid
@ -81,8 +83,12 @@ func useLogger(subsystemID string, logger btclog.Logger) {
case "HSWC":
hswcLog = logger
case "UTXN":
utxnLog = logger
case "BRAR":
brarLog = logger
}
}