Skip to content

Commit

Permalink
Merge pull request #47 from Elenpay/hotfix-liquidator-reports-balance…
Browse files Browse the repository at this point in the history
…-of-closed-channels

Liquidator reports balance of closed channels
  • Loading branch information
Jossec101 authored Sep 4, 2023
2 parents 68138b4 + 181e00b commit 840e465
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions liquidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ func monitorChannels(info MonitorChannelsInfo) {
loopProvider := provider.LoopProvider{}
//Infinite loop to monitor channels
for {
prometheusMetrics.channelBalanceGauge.Reset()

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

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

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

if info.liquidationRules == nil {
return
}

channelRules := info.liquidationRules[info.channel.GetChanId()]

//Manage liquidity if there are no pending htlcs
Expand Down

0 comments on commit 840e465

Please sign in to comment.