Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of various unnecessary warnings in logs #2981

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,19 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with

case Event(e: Error, d: DATA_CLOSING) => handleRemoteError(e, d)

case Event(INPUT_DISCONNECTED | INPUT_RECONNECTED(_, _, _), _) => stay() // we don't really care at this point
case Event(_: Shutdown, _) =>
log.debug("ignoring shutdown, closing transaction already published")
stay()

case Event(_: ClosingSigned, _) =>
log.debug("ignoring closing_signed, closing transaction already published")
stay()

case Event(_: AnnouncementSignatures, _) =>
log.debug("ignoring announcement_signatures, channel is closing")
stay()

case Event(INPUT_DISCONNECTED | _: INPUT_RECONNECTED, _) => stay() // we don't really care at this point
})

when(CLOSED)(handleExceptions {
Expand All @@ -2045,10 +2057,22 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
stay()

case Event(w: WatchTriggered, _) =>
log.warning("ignoring watch event, channel is closed (event={})", w)
log.debug("ignoring watch event, channel is closed (event={})", w)
stay()

case Event(_: Shutdown, _) =>
log.debug("ignoring shutdown, channel is closed")
stay()

case Event(_: ClosingSigned, _) =>
log.debug("ignoring closing_signed, channel is closed")
stay()

case Event(INPUT_DISCONNECTED, _) => stay() // we are disconnected, but it doesn't matter anymore
case Event(_: AnnouncementSignatures, _) =>
log.debug("ignoring announcement_signatures, channel is closed")
stay()

case Event(INPUT_DISCONNECTED | _: INPUT_RECONNECTED, _) => stay() // we are disconnected, but it doesn't matter anymore
})

when(OFFLINE)(handleExceptions {
Expand Down Expand Up @@ -2118,6 +2142,14 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with

case Event(c: CMD_ADD_HTLC, d: DATA_NORMAL) => handleAddDisconnected(c, d)

case Event(e: HtlcSettlementCommand, _) =>
log.debug("cannot settle htlc_id={}, channel is offline", e.id)
stay()

case Event(_: CMD_SIGN, _) => stay()

case Event(_: CMD_UPDATE_FEE, _) => stay()

case Event(c: CMD_UPDATE_RELAY_FEE, d: DATA_NORMAL) => handleUpdateRelayFeeDisconnected(c, d)

case Event(getTxResponse: GetTxWithMetaResponse, d: DATA_WAIT_FOR_FUNDING_CONFIRMED) if getTxResponse.txid == d.commitments.latest.fundingTxId => handleGetFundingTx(getTxResponse, d.waitingSince, d.fundingTx_opt)
Expand Down Expand Up @@ -2325,6 +2357,14 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with

case Event(c: CMD_ADD_HTLC, d: DATA_NORMAL) => handleAddDisconnected(c, d)

case Event(e: HtlcSettlementCommand, _) =>
log.debug("cannot settle htlc_id={}, channel is syncing", e.id)
stay()

case Event(_: CMD_SIGN, _) => stay()

case Event(_: CMD_UPDATE_FEE, _) => stay()

case Event(c: CMD_UPDATE_RELAY_FEE, d: DATA_NORMAL) => handleUpdateRelayFeeDisconnected(c, d)

case Event(channelReestablish: ChannelReestablish, d: DATA_SHUTDOWN) =>
Expand Down Expand Up @@ -2469,7 +2509,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
case Event(_: BroadcastChannelUpdate, _) => stay()

// we receive this when we tell the peer to disconnect
case Event("disconnecting", _) => stay()
case Event(_: Peer.DisconnectResponse, _) => stay()

// funding tx was confirmed in time, let's just ignore this
case Event(BITCOIN_FUNDING_TIMEOUT, _: PersistentChannelData) => stay()
Expand Down
45 changes: 28 additions & 17 deletions eclair-core/src/main/scala/fr/acinq/eclair/io/Peer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package fr.acinq.eclair.io

import akka.actor.typed.scaladsl.Behaviors
import akka.actor.typed.scaladsl.adapter.{ClassicActorContextOps, ClassicActorRefOps}
import akka.actor.{Actor, ActorContext, ActorRef, ExtendedActorSystem, FSM, OneForOneStrategy, PossiblyHarmful, Props, Status, SupervisorStrategy, Terminated, typed}
import akka.actor.{Actor, ActorContext, ActorRef, ExtendedActorSystem, FSM, OneForOneStrategy, PossiblyHarmful, Props, Status, SupervisorStrategy, typed}
import akka.event.Logging.MDC
import akka.event.{BusLogging, DiagnosticLoggingAdapter}
import akka.util.Timeout
Expand Down Expand Up @@ -103,11 +103,15 @@ class Peer(val nodeParams: NodeParams,
case Event(connectionReady: PeerConnection.ConnectionReady, d: DisconnectedData) =>
gotoConnected(connectionReady, d.channels.map { case (k: ChannelId, v) => (k, v) }, d.activeChannels, d.peerStorage)

case Event(Terminated(actor), d: DisconnectedData) if d.channels.values.toSet.contains(actor) =>
// we have at most 2 ids: a TemporaryChannelId and a FinalChannelId
val channelIds = d.channels.filter(_._2 == actor).keys
log.info(s"channel closed: channelId=${channelIds.mkString("/")}")
val channels1 = d.channels -- channelIds
case Event(ChannelTerminated(actor), d: DisconnectedData) =>
val channels1 = if (d.channels.values.toSet.contains(actor)) {
// we have at most 2 ids: a TemporaryChannelId and a FinalChannelId
val channelIds = d.channels.filter(_._2 == actor).keys
log.info(s"channel closed: channelId=${channelIds.mkString("/")}")
d.channels -- channelIds
} else {
d.channels
}
if (channels1.isEmpty && canForgetPendingOnTheFlyFunding()) {
log.info("that was the last open channel")
context.system.eventStream.publish(LastChannelClosed(self, remoteNodeId))
Expand Down Expand Up @@ -495,17 +499,21 @@ class Peer(val nodeParams: NodeParams,
goto(DISCONNECTED) using DisconnectedData(d.channels.collect { case (k: FinalChannelId, v) => (k, v) }, d.activeChannels, d.peerStorage)
}

case Event(Terminated(actor), d: ConnectedData) if d.channels.values.toSet.contains(actor) =>
// we have at most 2 ids: a TemporaryChannelId and a FinalChannelId
val channelIds = d.channels.filter(_._2 == actor).keys
log.info(s"channel closed: channelId=${channelIds.mkString("/")}")
val channels1 = d.channels -- channelIds
if (channels1.isEmpty) {
log.info("that was the last open channel, closing the connection")
context.system.eventStream.publish(LastChannelClosed(self, remoteNodeId))
d.peerConnection ! PeerConnection.Kill(KillReason.NoRemainingChannel)
case Event(ChannelTerminated(actor), d: ConnectedData) =>
if (d.channels.values.toSet.contains(actor)) {
// we have at most 2 ids: a TemporaryChannelId and a FinalChannelId
val channelIds = d.channels.filter(_._2 == actor).keys
log.info(s"channel closed: channelId=${channelIds.mkString("/")}")
val channels1 = d.channels -- channelIds
if (channels1.isEmpty) {
log.info("that was the last open channel, closing the connection")
context.system.eventStream.publish(LastChannelClosed(self, remoteNodeId))
d.peerConnection ! PeerConnection.Kill(KillReason.NoRemainingChannel)
}
stay() using d.copy(channels = channels1)
} else {
stay()
}
stay() using d.copy(channels = channels1)

case Event(connectionReady: PeerConnection.ConnectionReady, d: ConnectedData) =>
log.debug(s"got new connection, killing current one and switching")
Expand Down Expand Up @@ -843,7 +851,7 @@ class Peer(val nodeParams: NodeParams,

private def spawnChannel(): ActorRef = {
val channel = channelFactory.spawn(context, remoteNodeId)
context watch channel
context.watchWith(channel, ChannelTerminated(channel.ref))
channel
}

Expand Down Expand Up @@ -1088,6 +1096,9 @@ object Peer {
*/
case class ConnectionDown(peerConnection: ActorRef) extends RemoteTypes

/** A child channel actor has been terminated. */
case class ChannelTerminated(channel: ActorRef) extends RemoteTypes

case class RelayOnionMessage(messageId: ByteVector32, msg: OnionMessage, replyTo_opt: Option[typed.ActorRef[Status]])

case class RelayUnknownMessage(unknownMessage: UnknownMessage)
Expand Down
Loading