mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-19 01:43:22 +01:00
add a .getPrettySimpleName helper
It class `.getSimpleName` and strips the '$' character of object classes. Also, we don't need the java 8 workaround for `.getSimpleName`
This commit is contained in:
parent
f11f922c6b
commit
90a9fdce28
@ -389,7 +389,7 @@ object NodeParams extends Logging {
|
||||
require(pluginFeatureSet.size == pluginMessageParams.size, "Duplicate plugin feature bits found")
|
||||
|
||||
val interceptOpenChannelPlugins = pluginParams.collect { case p: InterceptOpenChannelPlugin => p }
|
||||
require(interceptOpenChannelPlugins.size <= 1, s"At most one plugin is allowed to intercept channel open messages, but multiple such plugins were registered: ${interceptOpenChannelPlugins.map(_.getClass.getSimpleName).mkString(", ")}. Disable conflicting plugins and restart eclair.")
|
||||
require(interceptOpenChannelPlugins.size <= 1, s"At most one plugin is allowed to intercept channel open messages, but multiple such plugins were registered: ${interceptOpenChannelPlugins.map(_.getClass.getPrettySimpleName).mkString(", ")}. Disable conflicting plugins and restart eclair.")
|
||||
|
||||
val coreAndPluginFeatures: Features[Feature] = features.copy(unknown = features.unknown ++ pluginMessageParams.map(_.pluginFeature))
|
||||
|
||||
|
@ -77,7 +77,7 @@ case class RbfAttemptAborted (override val channelId: Byte
|
||||
case class SpliceAttemptAborted (override val channelId: ByteVector32) extends ChannelException(channelId, "splice attempt aborted")
|
||||
case class SpliceAttemptTimedOut (override val channelId: ByteVector32) extends ChannelException(channelId, "splice attempt took too long, disconnecting")
|
||||
case class DualFundingAborted (override val channelId: ByteVector32) extends ChannelException(channelId, "dual funding aborted")
|
||||
case class UnexpectedInteractiveTxMessage (override val channelId: ByteVector32, msg: InteractiveTxMessage) extends ChannelException(channelId, s"unexpected interactive-tx message (${msg.getClass.getSimpleName})")
|
||||
case class UnexpectedInteractiveTxMessage (override val channelId: ByteVector32, msg: InteractiveTxMessage) extends ChannelException(channelId, s"unexpected interactive-tx message (${msg.getClass.getPrettySimpleName})")
|
||||
case class UnexpectedFundingSignatures (override val channelId: ByteVector32) extends ChannelException(channelId, "unexpected funding signatures (tx_signatures)")
|
||||
case class InvalidFundingFeerate (override val channelId: ByteVector32, targetFeerate: FeeratePerKw, actualFeerate: FeeratePerKw) extends ChannelException(channelId, s"invalid funding feerate: target=$targetFeerate actual=$actualFeerate")
|
||||
case class InvalidFundingSignature (override val channelId: ByteVector32, txId_opt: Option[TxId]) extends ChannelException(channelId, s"invalid funding signature: txId=${txId_opt.map(_.toString()).getOrElse("n/a")}")
|
||||
|
@ -1182,7 +1182,7 @@ case class Commitments(params: ChannelParams,
|
||||
def updateLocalFundingStatus(fundingTxId: TxId, status: LocalFundingStatus)(implicit log: LoggingAdapter): Either[Commitments, (Commitments, Commitment)] =
|
||||
updateFundingStatus(fundingTxId, _ => {
|
||||
case c if c.fundingTxId == fundingTxId =>
|
||||
log.info(s"setting localFundingStatus=${status.getClass.getSimpleName} for fundingTxId=${c.fundingTxId} fundingTxIndex=${c.fundingTxIndex}")
|
||||
log.info(s"setting localFundingStatus=${status.getClass.getPrettySimpleName} for fundingTxId=${c.fundingTxId} fundingTxIndex=${c.fundingTxIndex}")
|
||||
c.copy(localFundingStatus = status)
|
||||
case c => c
|
||||
})
|
||||
@ -1191,7 +1191,7 @@ case class Commitments(params: ChannelParams,
|
||||
updateFundingStatus(fundingTxId, fundingTxIndex => {
|
||||
// all funding older than this one are considered locked
|
||||
case c if c.fundingTxId == fundingTxId || c.fundingTxIndex < fundingTxIndex =>
|
||||
log.info(s"setting remoteFundingStatus=${RemoteFundingStatus.Locked.getClass.getSimpleName} for fundingTxId=${c.fundingTxId} fundingTxIndex=${c.fundingTxIndex}")
|
||||
log.info(s"setting remoteFundingStatus=${RemoteFundingStatus.Locked.getClass.getPrettySimpleName} for fundingTxId=${c.fundingTxId} fundingTxIndex=${c.fundingTxIndex}")
|
||||
c.copy(remoteFundingStatus = RemoteFundingStatus.Locked)
|
||||
case c => c
|
||||
})
|
||||
|
@ -389,7 +389,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
|
||||
when(NORMAL)(handleExceptions {
|
||||
case Event(c: ForbiddenCommandDuringQuiescence, d: DATA_NORMAL) if d.spliceStatus.isInstanceOf[QuiescenceNegotiation] =>
|
||||
val error = ForbiddenDuringQuiescence(d.channelId, c.getClass.getSimpleName)
|
||||
val error = ForbiddenDuringQuiescence(d.channelId, c.getClass.getPrettySimpleName)
|
||||
c match {
|
||||
case c: CMD_ADD_HTLC => handleAddHtlcCommandError(c, error, Some(d.channelUpdate))
|
||||
// Htlc settlement commands are ignored and will be replayed when not quiescent.
|
||||
@ -400,7 +400,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
}
|
||||
|
||||
case Event(c: ForbiddenCommandDuringSplice, d: DATA_NORMAL) if d.spliceStatus.isInstanceOf[QuiescentSpliceStatus] =>
|
||||
val error = ForbiddenDuringSplice(d.channelId, c.getClass.getSimpleName)
|
||||
val error = ForbiddenDuringSplice(d.channelId, c.getClass.getPrettySimpleName)
|
||||
c match {
|
||||
case c: CMD_ADD_HTLC => handleAddHtlcCommandError(c, error, Some(d.channelUpdate))
|
||||
// Htlc settlement commands are ignored and will be replayed when not quiescent.
|
||||
@ -411,8 +411,8 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
}
|
||||
|
||||
case Event(msg: ForbiddenMessageDuringSplice, d: DATA_NORMAL) if d.spliceStatus.isInstanceOf[QuiescentSpliceStatus] =>
|
||||
log.warning("received forbidden message {} during splicing with status {}", msg.getClass.getSimpleName, d.spliceStatus.getClass.getSimpleName)
|
||||
val error = ForbiddenDuringSplice(d.channelId, msg.getClass.getSimpleName)
|
||||
log.warning("received forbidden message {} during splicing with status {}", msg.getClass.getPrettySimpleName, d.spliceStatus.getClass.getPrettySimpleName)
|
||||
val error = ForbiddenDuringSplice(d.channelId, msg.getClass.getPrettySimpleName)
|
||||
// We forward preimages as soon as possible to the upstream channel because it allows us to pull funds.
|
||||
msg match {
|
||||
case fulfill: UpdateFulfillHtlc => d.commitments.receiveFulfill(fulfill) match {
|
||||
@ -1050,7 +1050,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
txBuilder ! InteractiveTxBuilder.ReceiveMessage(msg)
|
||||
stay()
|
||||
case _ =>
|
||||
log.info("ignoring unexpected interactive-tx message: {}", msg.getClass.getSimpleName)
|
||||
log.info("ignoring unexpected interactive-tx message: {}", msg.getClass.getPrettySimpleName)
|
||||
stay() sending Warning(d.channelId, UnexpectedInteractiveTxMessage(d.channelId, msg).getMessage)
|
||||
}
|
||||
|
||||
@ -1094,7 +1094,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
if (sessionId == currentSessionId) {
|
||||
stay() sending msg
|
||||
} else {
|
||||
log.info("ignoring outgoing interactive-tx message {} from previous session", msg.getClass.getSimpleName)
|
||||
log.info("ignoring outgoing interactive-tx message {} from previous session", msg.getClass.getPrettySimpleName)
|
||||
stay()
|
||||
}
|
||||
case InteractiveTxBuilder.Succeeded(signingSession, commitSig, liquidityPurchase_opt) =>
|
||||
@ -1113,7 +1113,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
}
|
||||
case _ =>
|
||||
// This can happen if we received a tx_abort right before receiving the interactive-tx result.
|
||||
log.warning("ignoring interactive-tx result with spliceStatus={}", d.spliceStatus.getClass.getSimpleName)
|
||||
log.warning("ignoring interactive-tx result with spliceStatus={}", d.spliceStatus.getClass.getPrettySimpleName)
|
||||
stay()
|
||||
}
|
||||
|
||||
@ -2625,7 +2625,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
}
|
||||
|
||||
private def handleAddHtlcCommandError(c: CMD_ADD_HTLC, cause: ChannelException, channelUpdate: Option[ChannelUpdate]) = {
|
||||
log.warning(s"${cause.getMessage} while processing cmd=${c.getClass.getSimpleName} in state=$stateName")
|
||||
log.warning(s"${cause.getMessage} while processing cmd=${c.getClass.getPrettySimpleName} in state=$stateName")
|
||||
val replyTo = if (c.replyTo == ActorRef.noSender) sender() else c.replyTo
|
||||
replyTo ! RES_ADD_FAILED(c, cause, channelUpdate)
|
||||
context.system.eventStream.publish(ChannelErrorOccurred(self, stateData.channelId, remoteNodeId, LocalError(cause), isFatal = false))
|
||||
@ -2633,7 +2633,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
}
|
||||
|
||||
private def handleCommandError(cause: ChannelException, c: channel.Command) = {
|
||||
log.warning(s"${cause.getMessage} while processing cmd=${c.getClass.getSimpleName} in state=$stateName")
|
||||
log.warning(s"${cause.getMessage} while processing cmd=${c.getClass.getPrettySimpleName} in state=$stateName")
|
||||
val replyTo_opt = c match {
|
||||
case hasOptionalReplyTo: HasOptionalReplyToCommand => hasOptionalReplyTo.replyTo_opt
|
||||
case hasReplyTo: HasReplyToCommand => if (hasReplyTo.replyTo == ActorRef.noSender) Some(sender()) else Some(hasReplyTo.replyTo)
|
||||
@ -2828,7 +2828,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
log.warning("quiescence timed out with no ongoing splice, did we forget to cancel the timer?")
|
||||
stay()
|
||||
} else {
|
||||
log.warning("quiescence timed out in state {}, closing connection", d.spliceStatus.getClass.getSimpleName)
|
||||
log.warning("quiescence timed out in state {}, closing connection", d.spliceStatus.getClass.getPrettySimpleName)
|
||||
context.system.scheduler.scheduleOnce(2 second, peer, Peer.Disconnect(remoteNodeId))
|
||||
stay() sending Warning(d.channelId, SpliceAttemptTimedOut(d.channelId).getMessage)
|
||||
}
|
||||
@ -2869,7 +2869,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
|
||||
override val supervisorStrategy: OneForOneStrategy = OneForOneStrategy(loggingEnabled = true) { case _ => SupervisorStrategy.Escalate }
|
||||
|
||||
override def aroundReceive(receive: Actor.Receive, msg: Any): Unit = {
|
||||
KamonExt.time(ProcessMessage.withTag("MessageType", msg.getClass.getSimpleName)) {
|
||||
KamonExt.time(ProcessMessage.withTag("MessageType", msg.getClass.getPrettySimpleName)) {
|
||||
super.aroundReceive(receive, msg)
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ trait ChannelOpenDualFunded extends DualFundingHandlers with ErrorHandlers {
|
||||
rollbackFundingAttempt(d.signingSession.fundingTx.tx, Nil)
|
||||
goto(CLOSED) sending TxAbort(d.channelId, DualFundingAborted(d.channelId).getMessage)
|
||||
case msg: InteractiveTxConstructionMessage =>
|
||||
log.info("received unexpected interactive-tx message: {}", msg.getClass.getSimpleName)
|
||||
log.info("received unexpected interactive-tx message: {}", msg.getClass.getPrettySimpleName)
|
||||
stay() sending Warning(d.channelId, UnexpectedInteractiveTxMessage(d.channelId, msg).getMessage)
|
||||
case _: TxInitRbf =>
|
||||
log.info("ignoring unexpected tx_init_rbf message")
|
||||
@ -631,7 +631,7 @@ trait ChannelOpenDualFunded extends DualFundingHandlers with ErrorHandlers {
|
||||
txBuilder ! InteractiveTxBuilder.ReceiveMessage(msg)
|
||||
stay()
|
||||
case _ =>
|
||||
log.info("ignoring unexpected interactive-tx message: {}", msg.getClass.getSimpleName)
|
||||
log.info("ignoring unexpected interactive-tx message: {}", msg.getClass.getPrettySimpleName)
|
||||
stay() sending Warning(d.channelId, UnexpectedInteractiveTxMessage(d.channelId, msg).getMessage)
|
||||
}
|
||||
|
||||
@ -706,7 +706,7 @@ trait ChannelOpenDualFunded extends DualFundingHandlers with ErrorHandlers {
|
||||
}
|
||||
case _ =>
|
||||
// This can happen if we received a tx_abort right before receiving the interactive-tx result.
|
||||
log.warning("ignoring interactive-tx result with rbfStatus={}", d.rbfStatus.getClass.getSimpleName)
|
||||
log.warning("ignoring interactive-tx result with rbfStatus={}", d.rbfStatus.getClass.getPrettySimpleName)
|
||||
stay()
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ package fr.acinq.eclair.channel.fsm
|
||||
import akka.actor.typed.scaladsl.adapter.actorRefAdapter
|
||||
import akka.actor.{ActorRef, FSM}
|
||||
import fr.acinq.bitcoin.scalacompat.{ByteVector32, OutPoint, SatoshiLong, Transaction, TxId}
|
||||
import fr.acinq.eclair.NotificationsLogger
|
||||
import fr.acinq.eclair.{NotificationsLogger, PrettySimpleClassName}
|
||||
import fr.acinq.eclair.NotificationsLogger.NotifyNodeOperator
|
||||
import fr.acinq.eclair.blockchain.bitcoind.ZmqWatcher.{RelativeDelay, WatchOutputSpent, WatchTxConfirmed}
|
||||
import fr.acinq.eclair.channel.Helpers.Closing
|
||||
@ -71,9 +71,9 @@ trait ErrorHandlers extends CommonHandlers {
|
||||
log.warning(s"force-closing channel at user request")
|
||||
case _ if msg.exists(_.isInstanceOf[OpenChannel]) || msg.exists(_.isInstanceOf[AcceptChannel]) =>
|
||||
// invalid remote channel parameters are logged as warning
|
||||
log.warning(s"${cause.getMessage} while processing msg=${msg.getOrElse("n/a").getClass.getSimpleName} in state=$stateName")
|
||||
log.warning(s"${cause.getMessage} while processing msg=${msg.getOrElse("n/a").getClass.getPrettySimpleName} in state=$stateName")
|
||||
case _: ChannelException =>
|
||||
log.error(s"${cause.getMessage} while processing msg=${msg.getOrElse("n/a").getClass.getSimpleName} in state=$stateName")
|
||||
log.error(s"${cause.getMessage} while processing msg=${msg.getOrElse("n/a").getClass.getPrettySimpleName} in state=$stateName")
|
||||
case _ =>
|
||||
// unhandled error: we dump the channel data, and print the stack trace
|
||||
log.error(cause, s"msg=${msg.getOrElse("n/a")} stateData=$stateData:")
|
||||
|
@ -28,7 +28,7 @@ import fr.acinq.eclair.crypto.ChaCha20Poly1305.ChaCha20Poly1305Error
|
||||
import fr.acinq.eclair.crypto.Noise._
|
||||
import fr.acinq.eclair.remote.EclairInternalsSerializer.RemoteTypes
|
||||
import fr.acinq.eclair.wire.protocol.{AnnouncementSignatures, RoutingMessage}
|
||||
import fr.acinq.eclair.{Diagnostics, FSMDiagnosticActorLogging, Logs, getSimpleClassName}
|
||||
import fr.acinq.eclair.{Diagnostics, FSMDiagnosticActorLogging, Logs, PrettySimpleClassName}
|
||||
import scodec.bits.ByteVector
|
||||
import scodec.{Attempt, Codec, DecodeResult}
|
||||
|
||||
@ -264,7 +264,7 @@ class TransportHandler[T: ClassTag](keyPair: KeyPair, rs: Option[ByteVector], co
|
||||
case Event(msg, d) =>
|
||||
d match {
|
||||
case n: NormalData[_] => log.warning(s"unhandled message $msg in state normal unackedSent=${n.unackedSent.size} unackedReceived=${n.unackedReceived.size} sendBuffer.lowPriority=${n.sendBuffer.lowPriority.size} sendBuffer.normalPriority=${n.sendBuffer.normalPriority.size}")
|
||||
case _ => log.warning(s"unhandled message $msg in state ${d.getClass.getSimpleName}")
|
||||
case _ => log.warning(s"unhandled message $msg in state ${d.getClass.getPrettySimpleName}")
|
||||
}
|
||||
stay()
|
||||
}
|
||||
@ -278,7 +278,7 @@ class TransportHandler[T: ClassTag](keyPair: KeyPair, rs: Option[ByteVector], co
|
||||
stateData match {
|
||||
case normal: NormalData[_] =>
|
||||
// NB: we deduplicate on the class name: each class will appear once but there may be many instances (less verbose and gives debug hints)
|
||||
log.info("stopping (unackedReceived={} unackedSent={})", normal.unackedReceived.keys.map(getSimpleClassName).toSet.mkString(","), normal.unackedSent.map(getSimpleClassName))
|
||||
log.info("stopping (unackedReceived={} unackedSent={})", normal.unackedReceived.keys.map(_.getClass.getPrettySimpleName).toSet.mkString(","), normal.unackedSent.map(_.getClass.getPrettySimpleName))
|
||||
case _ =>
|
||||
log.info("stopping")
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import fr.acinq.eclair.db.Monitoring.Tags.DbBackends
|
||||
import fr.acinq.eclair.db._
|
||||
import fr.acinq.eclair.payment._
|
||||
import fr.acinq.eclair.transactions.Transactions.PlaceHolderPubKey
|
||||
import fr.acinq.eclair.{MilliSatoshi, MilliSatoshiLong, Paginated, TimestampMilli}
|
||||
import fr.acinq.eclair.{MilliSatoshi, MilliSatoshiLong, Paginated, PrettySimpleClassName, TimestampMilli}
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
import java.sql.{Statement, Timestamp}
|
||||
@ -302,7 +302,7 @@ class PgAuditDb(implicit ds: DataSource) extends AuditDb with Logging {
|
||||
inTransaction { pg =>
|
||||
using(pg.prepareStatement("INSERT INTO audit.channel_errors VALUES (?, ?, ?, ?, ?, ?)")) { statement =>
|
||||
val (errorName, errorMessage) = e.error match {
|
||||
case LocalError(t) => (t.getClass.getSimpleName, t.getMessage)
|
||||
case LocalError(t) => (t.getClass.getPrettySimpleName, t.getMessage)
|
||||
case RemoteError(error) => ("remote", error.toAscii)
|
||||
}
|
||||
statement.setString(1, e.channelId.toHex)
|
||||
|
@ -111,7 +111,7 @@ class PgPaymentsDb(implicit ds: DataSource, lock: PgLock) extends PaymentsDb wit
|
||||
}
|
||||
|
||||
override def addOutgoingPayment(sent: OutgoingPayment): Unit = withMetrics("payments/add-outgoing", DbBackends.Postgres) {
|
||||
require(sent.status == OutgoingPaymentStatus.Pending, s"outgoing payment isn't pending (${sent.status.getClass.getSimpleName})")
|
||||
require(sent.status == OutgoingPaymentStatus.Pending, s"outgoing payment isn't pending (${sent.status.getClass.getPrettySimpleName})")
|
||||
withLock { pg =>
|
||||
using(pg.prepareStatement("INSERT INTO payments.sent (id, parent_id, external_id, payment_hash, payment_type, amount_msat, recipient_amount_msat, recipient_node_id, created_at, payment_request, offer_id, payer_key) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { statement =>
|
||||
statement.setString(1, sent.id.toString)
|
||||
|
@ -26,7 +26,7 @@ import fr.acinq.eclair.db.Monitoring.Tags.DbBackends
|
||||
import fr.acinq.eclair.db._
|
||||
import fr.acinq.eclair.payment._
|
||||
import fr.acinq.eclair.transactions.Transactions.PlaceHolderPubKey
|
||||
import fr.acinq.eclair.{MilliSatoshi, MilliSatoshiLong, Paginated, TimestampMilli}
|
||||
import fr.acinq.eclair.{MilliSatoshi, MilliSatoshiLong, Paginated, PrettySimpleClassName, TimestampMilli}
|
||||
import grizzled.slf4j.Logging
|
||||
|
||||
import java.sql.{Connection, Statement}
|
||||
@ -284,7 +284,7 @@ class SqliteAuditDb(val sqlite: Connection) extends AuditDb with Logging {
|
||||
override def add(e: ChannelErrorOccurred): Unit = withMetrics("audit/add-channel-error", DbBackends.Sqlite) {
|
||||
using(sqlite.prepareStatement("INSERT INTO channel_errors VALUES (?, ?, ?, ?, ?, ?)")) { statement =>
|
||||
val (errorName, errorMessage) = e.error match {
|
||||
case LocalError(t) => (t.getClass.getSimpleName, t.getMessage)
|
||||
case LocalError(t) => (t.getClass.getPrettySimpleName, t.getMessage)
|
||||
case RemoteError(error) => ("remote", error.toAscii)
|
||||
}
|
||||
statement.setBytes(1, e.channelId.toArray)
|
||||
|
@ -143,7 +143,7 @@ class SqlitePaymentsDb(val sqlite: Connection) extends PaymentsDb with Logging {
|
||||
}
|
||||
|
||||
override def addOutgoingPayment(sent: OutgoingPayment): Unit = withMetrics("payments/add-outgoing", DbBackends.Sqlite) {
|
||||
require(sent.status == OutgoingPaymentStatus.Pending, s"outgoing payment isn't pending (${sent.status.getClass.getSimpleName})")
|
||||
require(sent.status == OutgoingPaymentStatus.Pending, s"outgoing payment isn't pending (${sent.status.getClass.getPrettySimpleName})")
|
||||
using(sqlite.prepareStatement("INSERT INTO sent_payments (id, parent_id, external_id, payment_hash, payment_type, amount_msat, recipient_amount_msat, recipient_node_id, created_at, payment_request, offer_id, payer_key) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { statement =>
|
||||
statement.setString(1, sent.id.toString)
|
||||
statement.setString(2, sent.parentId.toString)
|
||||
|
@ -125,7 +125,7 @@ private class MessageRelay(nodeParams: NodeParams,
|
||||
case EncodedNodeId.WithPublicKey.Plain(nodeId) if nodeId == nodeParams.nodeId =>
|
||||
OnionMessages.process(nodeParams.privateKey, msg) match {
|
||||
case OnionMessages.DropMessage(reason) =>
|
||||
Metrics.OnionMessagesNotRelayed.withTag(Tags.Reason, reason.getClass.getSimpleName).increment()
|
||||
Metrics.OnionMessagesNotRelayed.withTag(Tags.Reason, reason.getClass.getPrettySimpleName).increment()
|
||||
replyTo_opt.foreach(_ ! DroppedMessage(messageId, reason))
|
||||
Behaviors.stopped
|
||||
case OnionMessages.SendMessage(nextNode, nextMessage) =>
|
||||
|
@ -79,7 +79,7 @@ object Monitoring {
|
||||
val Funded = "funded"
|
||||
val RelaySucceeded = "relay-succeeded"
|
||||
|
||||
def relayFailed(failure: OnTheFlyFunding.PaymentRelayer.RelayFailure) = s"relay-failed-${failure.getClass.getSimpleName}"
|
||||
def relayFailed(failure: OnTheFlyFunding.PaymentRelayer.RelayFailure) = s"relay-failed-${failure.getClass.getPrettySimpleName}"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ import fr.acinq.eclair.router.Router._
|
||||
import fr.acinq.eclair.transactions.DirectedHtlc
|
||||
import fr.acinq.eclair.transactions.Transactions._
|
||||
import fr.acinq.eclair.wire.protocol._
|
||||
import fr.acinq.eclair.{Alias, BlockHeight, CltvExpiry, CltvExpiryDelta, Feature, FeatureSupport, MilliSatoshi, ShortChannelId, TimestampMilli, TimestampSecond, UInt64, UnknownFeature}
|
||||
import fr.acinq.eclair.{Alias, BlockHeight, CltvExpiry, CltvExpiryDelta, Feature, FeatureSupport, MilliSatoshi, PrettySimpleClassName, ShortChannelId, TimestampMilli, TimestampSecond, UInt64, UnknownFeature}
|
||||
import org.json4s
|
||||
import org.json4s.JsonAST._
|
||||
import org.json4s.jackson.Serialization
|
||||
@ -395,7 +395,7 @@ object PaymentFailedSummarySerializer extends ConvertClassSerializer[PaymentFail
|
||||
|
||||
object ThrowableSerializer extends MinimalSerializer({
|
||||
case t: Throwable if t.getMessage != null => JString(t.getMessage)
|
||||
case t: Throwable => JString(t.getClass.getSimpleName)
|
||||
case t: Throwable => JString(t.getClass.getPrettySimpleName)
|
||||
})
|
||||
|
||||
object FailureMessageSerializer extends MinimalSerializer({
|
||||
@ -509,7 +509,7 @@ object ChannelEventSerializer extends MinimalSerializer({
|
||||
case e: ChannelClosed => JObject(
|
||||
JField("type", JString("channel-closed")),
|
||||
JField("channelId", JString(e.channelId.toHex)),
|
||||
JField("closingType", JString(e.closingType.getClass.getSimpleName))
|
||||
JField("closingType", JString(e.closingType.getClass.getPrettySimpleName))
|
||||
)
|
||||
})
|
||||
|
||||
@ -578,7 +578,7 @@ object FundingTxStatusSerializer extends ConvertClassSerializer[LocalFundingStat
|
||||
// @formatter:on
|
||||
|
||||
object TlvStreamSerializer extends ConvertClassSerializer[TlvStream[_]](tlvs =>
|
||||
tlvs.records.map(tlv => tlv.getClass.getSimpleName -> tlv).toMap ++
|
||||
tlvs.records.map(tlv => tlv.getClass.getPrettySimpleName -> tlv).toMap ++
|
||||
tlvs.unknown.map(unknown => ("Unknown" + unknown.tag.toString) -> unknown.value).toMap
|
||||
)
|
||||
|
||||
|
@ -108,9 +108,9 @@ package object eclair {
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
/**
|
||||
* Apparently .getClass.getSimpleName can crash java 8 with a "Malformed class name" error
|
||||
*/
|
||||
def getSimpleClassName(o: Any): String = o.getClass.getName.split("\\$").last
|
||||
implicit class PrettySimpleClassName[T](private val o: Class[T]) extends AnyVal {
|
||||
/** This removes trailing $ from `case object` class names */
|
||||
def getPrettySimpleName: String = o.getSimpleName.replace("$", "")
|
||||
}
|
||||
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
package fr.acinq.eclair.payment
|
||||
|
||||
import fr.acinq.bitcoin.scalacompat.Crypto.PublicKey
|
||||
import fr.acinq.eclair.MilliSatoshi
|
||||
import fr.acinq.eclair.{MilliSatoshi, PrettySimpleClassName}
|
||||
import fr.acinq.eclair.channel.CMD_FAIL_HTLC
|
||||
import kamon.Kamon
|
||||
|
||||
@ -127,12 +127,12 @@ object Monitoring {
|
||||
|
||||
def apply(cmdFail: CMD_FAIL_HTLC): String = cmdFail.reason match {
|
||||
case Left(_) => Remote
|
||||
case Right(f) => f.getClass.getSimpleName
|
||||
case Right(f) => f.getClass.getPrettySimpleName
|
||||
}
|
||||
|
||||
def apply(pf: PaymentFailure): String = pf match {
|
||||
case LocalFailure(_, _, t) => t.getClass.getSimpleName
|
||||
case RemoteFailure(_, _, e) => e.failureMessage.getClass.getSimpleName
|
||||
case LocalFailure(_, _, t) => t.getClass.getPrettySimpleName
|
||||
case RemoteFailure(_, _, e) => e.failureMessage.getClass.getPrettySimpleName
|
||||
case UnreadableRemoteFailure(_, _) => "UnreadableRemoteFailure"
|
||||
}
|
||||
}
|
||||
|
@ -145,13 +145,13 @@ class MultiPartHandler(nodeParams: NodeParams, register: ActorRef, db: IncomingP
|
||||
}
|
||||
|
||||
case RejectPacket(add, failure) if doHandle(add.paymentHash) =>
|
||||
Metrics.PaymentFailed.withTag(Tags.Direction, Tags.Directions.Received).withTag(Tags.Failure, failure.getClass.getSimpleName).increment()
|
||||
Metrics.PaymentFailed.withTag(Tags.Direction, Tags.Directions.Received).withTag(Tags.Failure, failure.getClass.getPrettySimpleName).increment()
|
||||
val cmdFail = CMD_FAIL_HTLC(add.id, Right(failure), commit = true)
|
||||
PendingCommandsDb.safeSend(register, nodeParams.db.pendingCommands, add.channelId, cmdFail)
|
||||
|
||||
case MultiPartPaymentFSM.MultiPartPaymentFailed(paymentHash, failure, parts) if doHandle(paymentHash) =>
|
||||
Logs.withMdc(log)(Logs.mdc(paymentHash_opt = Some(paymentHash))) {
|
||||
Metrics.PaymentFailed.withTag(Tags.Direction, Tags.Directions.Received).withTag(Tags.Failure, failure.getClass.getSimpleName).increment()
|
||||
Metrics.PaymentFailed.withTag(Tags.Direction, Tags.Directions.Received).withTag(Tags.Failure, failure.getClass.getPrettySimpleName).increment()
|
||||
log.warning("payment with paidAmount={} failed ({})", parts.map(_.amount).sum, failure)
|
||||
pendingPayments.get(paymentHash).foreach { case (_, handler: ActorRef) => handler ! PoisonPill }
|
||||
parts.collect {
|
||||
|
@ -99,7 +99,7 @@ class MultiPartPaymentFSM(nodeParams: NodeParams, paymentHash: ByteVector32, tot
|
||||
replyTo ! MultiPartPaymentSucceeded(paymentHash, parts)
|
||||
Metrics.ReceivedPaymentDuration.withTag(Tags.Success, value = true).record((TimestampMilli.now() - start).toMillis, TimeUnit.MILLISECONDS)
|
||||
case d =>
|
||||
log.error("unexpected payment success data {}", d.getClass.getSimpleName)
|
||||
log.error("unexpected payment success data {}", d.getClass.getPrettySimpleName)
|
||||
}
|
||||
case _ -> PAYMENT_FAILED =>
|
||||
nextStateData match {
|
||||
@ -108,7 +108,7 @@ class MultiPartPaymentFSM(nodeParams: NodeParams, paymentHash: ByteVector32, tot
|
||||
replyTo ! MultiPartPaymentFailed(paymentHash, failure, parts)
|
||||
Metrics.ReceivedPaymentDuration.withTag(Tags.Success, value = false).record((TimestampMilli.now() - start).toMillis, TimeUnit.MILLISECONDS)
|
||||
case d =>
|
||||
log.error("unexpected payment failure data {}", d.getClass.getSimpleName)
|
||||
log.error("unexpected payment failure data {}", d.getClass.getPrettySimpleName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class PaymentHandler(nodeParams: NodeParams, register: ActorRef, offerManager: t
|
||||
|
||||
private def addReceiveHandler(handle: Receive): Receive = {
|
||||
case handler: ReceiveHandler =>
|
||||
log.info(s"registering handler of type=${handler.getClass.getSimpleName}")
|
||||
log.info(s"registering handler of type=${handler.getClass.getPrettySimpleName}")
|
||||
// NB: the last handler that was added will be the first called
|
||||
context become normal(handler.handle(context, log) orElse handle)
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ class ChannelRelay private(nodeParams: NodeParams,
|
||||
safeSendAndStop(upstream.add.channelId, cmdFail)
|
||||
|
||||
case WrappedAddResponse(addFailed: RES_ADD_FAILED[_]) =>
|
||||
context.log.info("attempt failed with reason={}", addFailed.t.getClass.getSimpleName)
|
||||
context.log.info("attempt failed with reason={}", addFailed.t.getClass.getPrettySimpleName)
|
||||
context.self ! DoRelay
|
||||
relay(remoteFeatures_opt, previousFailures :+ PreviouslyTried(selectedChannelId, addFailed))
|
||||
|
||||
|
@ -42,7 +42,7 @@ import fr.acinq.eclair.router.Router.{ChannelHop, HopRelayParams, Route, RoutePa
|
||||
import fr.acinq.eclair.router.{BalanceTooLow, RouteNotFound}
|
||||
import fr.acinq.eclair.wire.protocol.PaymentOnion.IntermediatePayload
|
||||
import fr.acinq.eclair.wire.protocol._
|
||||
import fr.acinq.eclair.{Alias, CltvExpiry, CltvExpiryDelta, EncodedNodeId, Features, InitFeature, Logs, MilliSatoshi, MilliSatoshiLong, NodeParams, TimestampMilli, UInt64, nodeFee, randomBytes32}
|
||||
import fr.acinq.eclair.{Alias, CltvExpiry, CltvExpiryDelta, EncodedNodeId, Features, InitFeature, Logs, MilliSatoshi, MilliSatoshiLong, NodeParams, PrettySimpleClassName, TimestampMilli, UInt64, nodeFee, randomBytes32}
|
||||
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -170,7 +170,7 @@ object NodeRelay {
|
||||
val channelBalanceTooLow = failures.collectFirst { case f@LocalFailure(_, _, _: InsufficientFunds) => f }.nonEmpty
|
||||
val routeNotFound = failures.collectFirst { case f@LocalFailure(_, _, RouteNotFound) => f }.nonEmpty
|
||||
val res = featureOk && (routerBalanceTooLow || channelBalanceTooLow || routeNotFound)
|
||||
context.log.info(s"on-the-fly funding assessment: shouldAttempt=$res featureOk=$featureOk routerBalanceTooLow=$routerBalanceTooLow channelBalanceTooLow=$channelBalanceTooLow localFailures={}", failures.collect { case f: LocalFailure => f.t.getClass.getSimpleName }.mkString(","))
|
||||
context.log.info(s"on-the-fly funding assessment: shouldAttempt=$res featureOk=$featureOk routerBalanceTooLow=$routerBalanceTooLow channelBalanceTooLow=$channelBalanceTooLow localFailures={}", failures.collect { case f: LocalFailure => f.t.getClass.getPrettySimpleName }.mkString(","))
|
||||
res
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ class NodeRelay private(nodeParams: NodeParams,
|
||||
receiving(htlcs :+ Upstream.Hot.Channel(packet.add.removeUnknownTlvs(), TimestampMilli.now(), originNode), nextPayload, nextPacket_opt, handler)
|
||||
case WrappedMultiPartPaymentFailed(MultiPartPaymentFSM.MultiPartPaymentFailed(_, failure, parts)) =>
|
||||
context.log.warn("could not complete incoming multi-part payment (parts={} paidAmount={} failure={})", parts.size, parts.map(_.amount).sum, failure)
|
||||
Metrics.recordPaymentRelayFailed(failure.getClass.getSimpleName, Tags.RelayType.Trampoline)
|
||||
Metrics.recordPaymentRelayFailed(failure.getClass.getPrettySimpleName, Tags.RelayType.Trampoline)
|
||||
parts.collect { case p: MultiPartPaymentFSM.HtlcPart => rejectHtlc(p.htlc.id, p.htlc.channelId, p.amount, Some(failure)) }
|
||||
stopping()
|
||||
case WrappedMultiPartPaymentSucceeded(MultiPartPaymentFSM.MultiPartPaymentSucceeded(_, parts)) =>
|
||||
@ -478,7 +478,7 @@ class NodeRelay private(nodeParams: NodeParams,
|
||||
}
|
||||
|
||||
private def rejectPayment(upstream: Upstream.Hot.Trampoline, failure: Option[FailureMessage]): Unit = {
|
||||
Metrics.recordPaymentRelayFailed(failure.map(_.getClass.getSimpleName).getOrElse("Unknown"), Tags.RelayType.Trampoline)
|
||||
Metrics.recordPaymentRelayFailed(failure.map(_.getClass.getPrettySimpleName).getOrElse("Unknown"), Tags.RelayType.Trampoline)
|
||||
upstream.received.foreach(r => rejectHtlc(r.add.id, r.add.channelId, upstream.amountIn, failure))
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ object OnTheFlyFunding {
|
||||
case object ExpiryTooClose extends RelayFailure { override def toString: String = "htlcs are too close to expiry to be relayed" }
|
||||
case class ChannelNotAvailable(state: ChannelState) extends RelayFailure { override def toString: String = s"channel is not ready for payments (state=${state.toString})" }
|
||||
case class CannotAddToChannel(t: Throwable) extends RelayFailure { override def toString: String = s"could not relay on-the-fly HTLC: ${t.getMessage}" }
|
||||
case class RemoteFailure(failure: HtlcResult.Fail) extends RelayFailure { override def toString: String = s"relayed on-the-fly HTLC was failed: ${failure.getClass.getSimpleName}" }
|
||||
case class RemoteFailure(failure: HtlcResult.Fail) extends RelayFailure { override def toString: String = s"relayed on-the-fly HTLC was failed: ${failure.getClass.getPrettySimpleName}" }
|
||||
// @formatter:on
|
||||
|
||||
def apply(nodeParams: NodeParams, remoteNodeId: PublicKey, channelId: ByteVector32, paymentHash: ByteVector32): Behavior[Command] =
|
||||
|
@ -163,7 +163,7 @@ class PostRestartHtlcCleaner(nodeParams: NodeParams, register: ActorRef, initial
|
||||
log.info("htlc #{} from channelId={} failed downstream but has a pending on-the-fly funding", htlc.id, htlc.channelId)
|
||||
// We don't fail upstream: we haven't been paid our funding fee yet, so we will try relaying again.
|
||||
} else {
|
||||
log.info("htlc #{} from channelId={} failed downstream: {}", htlc.id, htlc.channelId, fail.getClass.getSimpleName)
|
||||
log.info("htlc #{} from channelId={} failed downstream: {}", htlc.id, htlc.channelId, fail.getClass.getPrettySimpleName)
|
||||
handleDownstreamFailure(brokenHtlcs, o, htlc, fail)
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class ScodecSerializer[T <: AnyRef](override val identifier: Int, codec: Codec[T
|
||||
}
|
||||
|
||||
/** we don't rely on the manifest to provide backward compatibility, we will use dedicated codecs instead */
|
||||
override def manifest(o: AnyRef): String = fr.acinq.eclair.getSimpleClassName(o)
|
||||
override def manifest(o: AnyRef): String = o.getClass.getName
|
||||
|
||||
override def toBinary(o: AnyRef): Array[Byte] = codec.encode(o.asInstanceOf[T]).require.toByteArray
|
||||
|
||||
|
@ -19,7 +19,7 @@ package fr.acinq.eclair.router
|
||||
import fr.acinq.bitcoin.scalacompat.{BtcDouble, MilliBtcDouble, SatoshiLong}
|
||||
import fr.acinq.eclair.router.Router.GossipDecision
|
||||
import fr.acinq.eclair.wire.protocol.ChannelUpdate
|
||||
import fr.acinq.eclair.{MilliSatoshi, getSimpleClassName}
|
||||
import fr.acinq.eclair.{MilliSatoshi, PrettySimpleClassName}
|
||||
import kamon.Kamon
|
||||
import kamon.metric.{Counter, MeasurementUnit}
|
||||
|
||||
@ -64,7 +64,7 @@ object Monitoring {
|
||||
|
||||
def gossipResult(decision: GossipDecision): Counter = decision match {
|
||||
case _: GossipDecision.Accepted => GossipResult.withTag("result", "accepted")
|
||||
case rejected: GossipDecision.Rejected => GossipResult.withTag("result", "rejected").withTag("reason", getSimpleClassName(rejected))
|
||||
case rejected: GossipDecision.Rejected => GossipResult.withTag("result", "rejected").withTag("reason", rejected.getClass.getPrettySimpleName)
|
||||
}
|
||||
|
||||
private val RelayProbabilityEstimate = Kamon.histogram("router.balance-estimates.remote-edge-relay", "Estimated probability (in percent) that the relay will be successful")
|
||||
|
@ -231,7 +231,7 @@ object RouteCalculation {
|
||||
ctx.sender() ! Status.Failure(failure)
|
||||
case Failure(t) =>
|
||||
val failure = if (isNeighborBalanceTooLow(d.graphWithBalances.graph, r.source, targetNodeId, amountToSend)) BalanceTooLow else t
|
||||
Metrics.FindRouteErrors.withTags(tags.withTag(Tags.Error, failure.getClass.getSimpleName)).increment()
|
||||
Metrics.FindRouteErrors.withTags(tags.withTag(Tags.Error, failure.getClass.getPrettySimpleName)).increment()
|
||||
ctx.sender() ! Status.Failure(failure)
|
||||
}
|
||||
}
|
||||
|
@ -550,14 +550,14 @@ object LightningMessageCodecs {
|
||||
discriminatorWithDefault(lightningMessageCodec, unknownMessageCodec.upcast)
|
||||
|
||||
val meteredLightningMessageCodec = Codec[LightningMessage](
|
||||
(msg: LightningMessage) => KamonExt.time(Metrics.EncodeDuration.withTag(Tags.MessageType, msg.getClass.getSimpleName))(lightningMessageCodecWithFallback.encode(msg)),
|
||||
(msg: LightningMessage) => KamonExt.time(Metrics.EncodeDuration.withTag(Tags.MessageType, msg.getClass.getPrettySimpleName))(lightningMessageCodecWithFallback.encode(msg)),
|
||||
(bits: BitVector) => {
|
||||
// this is a bit more involved, because we don't know beforehand what the type of the message will be
|
||||
val begin = System.nanoTime()
|
||||
val res = lightningMessageCodecWithFallback.decode(bits)
|
||||
val end = System.nanoTime()
|
||||
val messageType = res match {
|
||||
case Attempt.Successful(decoded) => decoded.value.getClass.getSimpleName
|
||||
case Attempt.Successful(decoded) => decoded.value.getClass.getPrettySimpleName
|
||||
case Attempt.Failure(_) => "unknown"
|
||||
}
|
||||
Metrics.DecodeDuration.withTag(Tags.MessageType, messageType).record(end - begin)
|
||||
|
@ -18,7 +18,7 @@ package fr.acinq.eclair
|
||||
|
||||
import fr.acinq.bitcoin.BitcoinError.ChainHashMismatch
|
||||
import fr.acinq.bitcoin.scalacompat.Crypto.PrivateKey
|
||||
import fr.acinq.bitcoin.scalacompat.{Block, ByteVector32, Crypto, Script, TxHash, TxId, addressToPublicKeyScript}
|
||||
import fr.acinq.bitcoin.scalacompat.{Block, ByteVector32, Crypto, Script, TxId, addressToPublicKeyScript}
|
||||
import fr.acinq.bitcoin.{Base58, Base58Check, Bech32}
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import scodec.bits._
|
||||
@ -114,4 +114,22 @@ class PackageSpec extends AnyFunSuite {
|
||||
assert(ShortChannelId(Long.MaxValue) < ShortChannelId(Long.MaxValue + 1))
|
||||
}
|
||||
|
||||
test("non-reg getPrettySimpleName") {
|
||||
val testCases = Map(
|
||||
Foo() -> "Foo",
|
||||
Foo.Bar -> "Bar",
|
||||
Foo.Baz(42) -> "Baz"
|
||||
)
|
||||
|
||||
testCases.foreach { case (o, ref) => assert(o.getClass.getPrettySimpleName == ref) }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
case class Foo()
|
||||
object Foo {
|
||||
case object Bar
|
||||
case class Baz(i: Int)
|
||||
}
|
||||
// @formatter:on
|
||||
|
@ -55,7 +55,7 @@ object Boot extends App with Logging {
|
||||
}
|
||||
|
||||
def onError(t: Throwable): Unit = {
|
||||
val errorMsg = if (t.getMessage != null) t.getMessage else t.getClass.getSimpleName
|
||||
val errorMsg = if (t.getMessage != null) t.getMessage else t.getClass.getPrettySimpleName
|
||||
System.err.println(s"fatal error: $errorMsg")
|
||||
logger.error(s"fatal error: $errorMsg", t)
|
||||
sys.exit(1)
|
||||
|
@ -27,7 +27,7 @@ import fr.acinq.eclair.crypto.TransportHandler
|
||||
import fr.acinq.eclair.io.Peer.PeerRoutingMessage
|
||||
import fr.acinq.eclair.router.Router._
|
||||
import fr.acinq.eclair.wire.protocol._
|
||||
import fr.acinq.eclair.{FSMDiagnosticActorLogging, Logs, RealShortChannelId, getSimpleClassName}
|
||||
import fr.acinq.eclair.{FSMDiagnosticActorLogging, Logs, PrettySimpleClassName, RealShortChannelId}
|
||||
import kamon.Kamon
|
||||
import kamon.metric.Counter
|
||||
|
||||
@ -128,7 +128,7 @@ class FrontRouter(routerConf: RouterConf, remoteRouter: ActorRef, initialized: O
|
||||
d.copy(rebroadcast = d.rebroadcast.copy(updates = d.rebroadcast.updates + (u -> (d.rebroadcast.updates(u) + origin))))
|
||||
case _ =>
|
||||
Metrics.gossipForwarded(ann).increment()
|
||||
log.debug("sending announcement class={} to master router", ann.getClass.getSimpleName)
|
||||
log.debug("sending announcement class={} to master router", ann.getClass.getPrettySimpleName)
|
||||
remoteRouter ! PeerRoutingMessage(self, remoteNodeId, ann) // nb: we set ourselves as the origin
|
||||
d.copy(processing = d.processing + (ann -> Set(origin)))
|
||||
}
|
||||
@ -186,7 +186,7 @@ class FrontRouter(routerConf: RouterConf, remoteRouter: ActorRef, initialized: O
|
||||
}
|
||||
|
||||
case Event(msg: PeerRoutingMessage, _) =>
|
||||
log.debug("forwarding peer routing message class={}", msg.message.getClass.getSimpleName)
|
||||
log.debug("forwarding peer routing message class={}", msg.message.getClass.getPrettySimpleName)
|
||||
remoteRouter forward msg
|
||||
stay()
|
||||
|
||||
@ -224,15 +224,15 @@ object FrontRouter {
|
||||
private val RouterEvent = Kamon.counter("front.router.event")
|
||||
|
||||
// @formatter:off
|
||||
def gossipDropped(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "dropped").withTag("type", getSimpleClassName(ann))
|
||||
def gossipStashed(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "stashed").withTag("type", getSimpleClassName(ann))
|
||||
def gossipStashedRebroadcast(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "stashed-rebroadcast").withTag("type", getSimpleClassName(ann))
|
||||
def gossipForwarded(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "forwarded").withTag("type", getSimpleClassName(ann))
|
||||
def gossipDropped(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "dropped").withTag("type", ann.getClass.getPrettySimpleName)
|
||||
def gossipStashed(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "stashed").withTag("type", ann.getClass.getPrettySimpleName)
|
||||
def gossipStashedRebroadcast(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "stashed-rebroadcast").withTag("type", ann.getClass.getPrettySimpleName)
|
||||
def gossipForwarded(ann: AnnouncementMessage): Counter = Gossip.withTag("status", "forwarded").withTag("type", ann.getClass.getPrettySimpleName)
|
||||
|
||||
def gossipAccepted(ann: AnnouncementMessage): Counter = GossipResult.withTag("result", "accepted").withTag("type", getSimpleClassName(ann))
|
||||
def gossipRejected(ann: AnnouncementMessage, reason: GossipDecision.Rejected): Counter = GossipResult.withTag("result", "rejected").withTag("reason", getSimpleClassName(reason)).withTag("type", getSimpleClassName(ann))
|
||||
def gossipAccepted(ann: AnnouncementMessage): Counter = GossipResult.withTag("result", "accepted").withTag("type", ann.getClass.getPrettySimpleName)
|
||||
def gossipRejected(ann: AnnouncementMessage, reason: GossipDecision.Rejected): Counter = GossipResult.withTag("result", "rejected").withTag("reason", reason.getClass.getPrettySimpleName).withTag("type", ann.getClass.getPrettySimpleName)
|
||||
|
||||
def routerEvent(event: NetworkEvent): Counter = RouterEvent.withTag("type", getSimpleClassName(event))
|
||||
def routerEvent(event: NetworkEvent): Counter = RouterEvent.withTag("type", event.getClass.getPrettySimpleName)
|
||||
// @formatter:on
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ object Boot extends App with Logging {
|
||||
val config = NodeParams.loadConfiguration(datadir)
|
||||
|
||||
val plugins = Plugin.loadPlugins(args.toIndexedSeq.map(new File(_)))
|
||||
plugins.foreach(plugin => logger.info(s"loaded plugin ${plugin.getClass.getSimpleName}"))
|
||||
plugins.foreach(plugin => logger.info(s"loaded plugin ${plugin.getClass.getPrettySimpleName}"))
|
||||
implicit val system: ActorSystem = ActorSystem("eclair-node", config)
|
||||
implicit val ec: ExecutionContext = system.dispatcher
|
||||
|
||||
@ -85,7 +85,7 @@ object Boot extends App with Logging {
|
||||
}
|
||||
|
||||
def onError(t: Throwable): Unit = {
|
||||
val errorMsg = if (t.getMessage != null) t.getMessage else t.getClass.getSimpleName
|
||||
val errorMsg = if (t.getMessage != null) t.getMessage else t.getClass.getPrettySimpleName
|
||||
System.err.println(s"fatal error: $errorMsg")
|
||||
logger.error(s"fatal error: $errorMsg", t)
|
||||
NotificationsLogger.logFatalError("could not start eclair", t)
|
||||
|
Loading…
Reference in New Issue
Block a user