Skip to content

Commit 840e465

Browse files
authored
Merge pull request #47 from Elenpay/hotfix-liquidator-reports-balance-of-closed-channels
Liquidator reports balance of closed channels
2 parents 68138b4 + 181e00b commit 840e465

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

liquidator.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ func monitorChannels(info MonitorChannelsInfo) {
274274
loopProvider := provider.LoopProvider{}
275275
//Infinite loop to monitor channels
276276
for {
277+
prometheusMetrics.channelBalanceGauge.Reset()
277278

278279
//Call ListChannels method of lightning client with metadata headers
279280
response, err := info.lightningClient.ListChannels(info.nodeCtx, &lnrpc.ListChannelsRequest{
@@ -299,8 +300,6 @@ func monitorChannels(info MonitorChannelsInfo) {
299300
liquidationRules, err := rulesCache.GetLiquidityRules(nodePubKey)
300301
if err != nil {
301302
log.Debugf("failed to get liquidation rules from cache: %v for node %s", err, nodePubKey)
302-
time.Sleep(pollingInterval)
303-
continue
304303
}
305304

306305
//Iterate over response channels
@@ -352,6 +351,10 @@ func monitorChannel(info MonitorChannelInfo) {
352351

353352
recordChannelBalanceMetric(info.nodeHost, info.channel, channelBalanceRatio, info.lightningClient, spanCtx)
354353

354+
if info.liquidationRules == nil {
355+
return
356+
}
357+
355358
channelRules := info.liquidationRules[info.channel.GetChanId()]
356359

357360
//Manage liquidity if there are no pending htlcs

0 commit comments

Comments
 (0)