Skip to content

Commit

Permalink
Log balance estimate updates (#2994)
Browse files Browse the repository at this point in the history
This will allow us to try different algorithms to estimate the balance and evaluate them on historical data.
  • Loading branch information
thomash-acinq authored Feb 4, 2025
1 parent 03ba2f8 commit b6aa4cc
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ case class BalancesEstimates(balances: Map[(PublicKey, PublicKey), BalanceEstima
)

def channelCouldSend(hop: ChannelHop, amount: MilliSatoshi)(implicit log: LoggingAdapter): BalancesEstimates = {
log.info("channelCouldSend: amount={} scid={} from={} to={}", amount, hop.shortChannelId, hop.nodeId, hop.nextNodeId)
get(hop.nodeId, hop.nextNodeId).foreach { balance =>
val estimatedProbability = balance.canSend(amount, TimestampSecond.now())
Monitoring.Metrics.remoteEdgeRelaySuccess(estimatedProbability)
Expand All @@ -292,6 +293,7 @@ case class BalancesEstimates(balances: Map[(PublicKey, PublicKey), BalanceEstima
}

def channelCouldNotSend(hop: ChannelHop, amount: MilliSatoshi)(implicit log: LoggingAdapter): BalancesEstimates = {
log.info("channelCouldNotSend: amount={} scid={} from={} to={}", amount, hop.shortChannelId, hop.nodeId, hop.nextNodeId)
get(hop.nodeId, hop.nextNodeId).foreach { balance =>
val estimatedProbability = balance.canSend(amount, TimestampSecond.now())
Monitoring.Metrics.remoteEdgeRelayFailure(estimatedProbability)
Expand All @@ -300,6 +302,7 @@ case class BalancesEstimates(balances: Map[(PublicKey, PublicKey), BalanceEstima
}

def channelDidSend(hop: ChannelHop, amount: MilliSatoshi)(implicit log: LoggingAdapter): BalancesEstimates = {
log.info("channelDidSend: amount={} scid={} from={} to={}", amount, hop.shortChannelId, hop.nodeId, hop.nextNodeId)
get(hop.nodeId, hop.nextNodeId).foreach { balance =>
val estimatedProbability = balance.canSend(amount, TimestampSecond.now())
Monitoring.Metrics.remoteEdgeRelaySuccess(estimatedProbability)
Expand Down

0 comments on commit b6aa4cc

Please sign in to comment.