Skip to content

Commit

Permalink
Do not store CannotAffordFees errors (#1834)
Browse files Browse the repository at this point in the history
That error can get spammy because it will be emitted at every block for
every channel, and it doesn't bring a lot of value to store it anyway.
  • Loading branch information
pm47 authored Jun 7, 2021
1 parent bd6bad1 commit a7bb2c2
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,17 @@ class DbEventHandler(nodeParams: NodeParams) extends Actor with ActorLogging {
case e: NetworkFeePaid => auditDb.add(e)

case e: ChannelErrorOccurred =>
// first pattern matching level is to ignore some errors, second level is to separate between different kind of errors
e.error match {
case LocalError(_) if e.isFatal => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Local).withTag(ChannelTags.Fatal, value = true).increment()
case LocalError(_) if !e.isFatal => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Local).withTag(ChannelTags.Fatal, value = false).increment()
case RemoteError(_) => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Remote).increment()
case LocalError(_: CannotAffordFees) => () // will be thrown at each new block if our balance is too low to update the commitment fee
case _ =>
e.error match {
case LocalError(_) if e.isFatal => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Local).withTag(ChannelTags.Fatal, value = true).increment()
case LocalError(_) if !e.isFatal => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Local).withTag(ChannelTags.Fatal, value = false).increment()
case RemoteError(_) => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Remote).increment()
}
auditDb.add(e)
}
auditDb.add(e)

case e: ChannelStateChanged =>
// NB: order matters!
Expand Down

0 comments on commit a7bb2c2

Please sign in to comment.