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:
10 files changed
+593
-43
No files matched your search
+14
-12
@@ -1114,24 +1114,26 @@ func testRevokedCloseRetribution(net *networkHarness, t *harnessTest) {
|
||||
// broadcast as Bob's contract breaching transaction gets confirmed
|
||||
// above.
|
||||
var justiceTXID *wire.ShaHash
|
||||
breakTimeout := time.After(time.Second * 5)
|
||||
poll:
|
||||
for {
|
||||
select {
|
||||
case <-time.After(time.Second * 5):
|
||||
case <-breakTimeout:
|
||||
t.Fatalf("justice tx not found in mempool")
|
||||
default:
|
||||
mempool, err := net.Miner.Node.GetRawMempool()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to get mempool: %v", err)
|
||||
}
|
||||
|
||||
if len(mempool) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
justiceTXID = mempool[0]
|
||||
break poll
|
||||
}
|
||||
|
||||
mempool, err := net.Miner.Node.GetRawMempool()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to get mempool: %v", err)
|
||||
}
|
||||
|
||||
if len(mempool) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
justiceTXID = mempool[0]
|
||||
break poll
|
||||
}
|
||||
|
||||
// Query for the mempool transaction found above. Then assert that all
|
||||
|
||||
Reference in new issue
Block a user