Skip to content

Commit

Permalink
minor rewordings
Browse files Browse the repository at this point in the history
  • Loading branch information
pm47 committed Sep 9, 2021
1 parent 4968fb9 commit a25bc6a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions eclair-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ eclair {
max-block-processing-delay = 30 seconds // we add a random delay before processing blocks, capped at this value, to prevent herd effect
max-tx-publish-retry-delay = 60 seconds // we add a random delay before retrying failed transaction publication

outdated-commitment-strategy = "always-request-remote-close" // always-request-remote-close or halt-if-just-restarted
unhandled-exception-strategy = "local-force-close" // local-force-close or log-and-stop
outdated-commitment-strategy = "remote-close" // remote-close or stop (NB: the app will only stop if it was recently restarted)
unhandled-exception-strategy = "local-close" // local-close or stop

relay.fees {
// Fees for public channels
Expand Down
8 changes: 4 additions & 4 deletions eclair-core/src/main/scala/fr/acinq/eclair/NodeParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ object NodeParams extends Logging {
}

val outdatedCommitmentStrategy = config.getString("outdated-commitment-strategy") match {
case "halt-if-just-restarted" => OutdatedCommitmentStrategy.HaltIfJustRestarted
case "always-request-remote-close" => OutdatedCommitmentStrategy.AlwaysRequestRemoteClose
case "remote-close" => OutdatedCommitmentStrategy.RemoteClose
case "stop" => OutdatedCommitmentStrategy.Stop
}

val unhandledExceptionStrategy = config.getString("unhandled-exception-strategy") match {
case "local-force-close" => UnhandledExceptionStrategy.LocalForceClose
case "log-and-stop" => UnhandledExceptionStrategy.LogAndStop
case "local-close" => UnhandledExceptionStrategy.LocalClose
case "stop" => UnhandledExceptionStrategy.Stop
}

val routerSyncEncodingType = config.getString("router.sync.encoding-type") match {
Expand Down
16 changes: 8 additions & 8 deletions eclair-core/src/main/scala/fr/acinq/eclair/channel/Channel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ object Channel {
* that we are using an outdated commitment.
* This may be the best choice for smaller loosely administered nodes.
*/
case object AlwaysRequestRemoteClose extends OutdatedCommitmentStrategy
case object RemoteClose extends OutdatedCommitmentStrategy
/**
* If the node was just restarted, just log an error and stop the app. The goal is to prevent unwanted mass
* force-close of channels if we accidentally restarted the node with an outdated backup. After a few minutes, we
* revert to the default behavior of requesting our peer to force close, otherwise this opens a huge attack vector
* where any peer can remotely stop our node.
* This strategy may be better suited for larger nodes, closely administered.
*/
case object HaltIfJustRestarted extends OutdatedCommitmentStrategy
case object Stop extends OutdatedCommitmentStrategy
}
// @formatter:on

Expand All @@ -154,9 +154,9 @@ object Channel {
sealed trait UnhandledExceptionStrategy
object UnhandledExceptionStrategy {
/** Ask our counterparty to close the channel. This may be the best choice for smaller loosely administered nodes.*/
case object LocalForceClose extends UnhandledExceptionStrategy
case object LocalClose extends UnhandledExceptionStrategy
/** Just log an error and stop the node. May be better for larger nodes, to prevent unwanted mass force-close.*/
case object LogAndStop extends UnhandledExceptionStrategy
case object Stop extends UnhandledExceptionStrategy
}
// @formatter:on

Expand Down Expand Up @@ -2311,9 +2311,9 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId
case _ =>
// unhandled exception: we apply the configured strategy
nodeParams.unhandledExceptionStrategy match {
case UnhandledExceptionStrategy.LocalForceClose =>
case UnhandledExceptionStrategy.LocalClose =>
spendLocalCurrent(dd) sending error
case UnhandledExceptionStrategy.LogAndStop =>
case UnhandledExceptionStrategy.Stop =>
log.error("stopping the node (unhandled exception")
System.exit(1)
stop(FSM.Shutdown)
Expand Down Expand Up @@ -2561,11 +2561,11 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId

private def handleOutdatedCommitment(channelReestablish: ChannelReestablish, d: HasCommitments) = {
nodeParams.outdatedCommitmentStrategy match {
case OutdatedCommitmentStrategy.HaltIfJustRestarted if ManagementFactory.getRuntimeMXBean.getUptime.millis < 10.minutes =>
case OutdatedCommitmentStrategy.Stop if ManagementFactory.getRuntimeMXBean.getUptime.millis < 10.minutes =>
log.error("we just restarted and may have an outdated commitment! stopping the node")
System.exit(1)
stop(FSM.Shutdown)
case OutdatedCommitmentStrategy.AlwaysRequestRemoteClose =>
case OutdatedCommitmentStrategy.RemoteClose =>
val exc = PleasePublishYourCommitment(d.channelId)
val error = Error(d.channelId, exc.getMessage)
goto(WAIT_FOR_REMOTE_PUBLISH_FUTURE_COMMITMENT) using DATA_WAIT_FOR_REMOTE_PUBLISH_FUTURE_COMMITMENT(d.commitments, channelReestablish) storing() sending error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ object TestConstants {
feeProportionalMillionths = 30)),
reserveToFundingRatio = 0.01, // note: not used (overridden below)
maxReserveToFundingRatio = 0.05,
outdatedCommitmentStrategy = OutdatedCommitmentStrategy.AlwaysRequestRemoteClose,
unhandledExceptionStrategy = UnhandledExceptionStrategy.LocalForceClose,
outdatedCommitmentStrategy = OutdatedCommitmentStrategy.RemoteClose,
unhandledExceptionStrategy = UnhandledExceptionStrategy.LocalClose,
db = TestDatabases.inMemoryDb(),
revocationTimeout = 20 seconds,
autoReconnect = false,
Expand Down Expand Up @@ -270,8 +270,8 @@ object TestConstants {
feeProportionalMillionths = 30)),
reserveToFundingRatio = 0.01, // note: not used (overridden below)
maxReserveToFundingRatio = 0.05,
outdatedCommitmentStrategy = OutdatedCommitmentStrategy.AlwaysRequestRemoteClose,
unhandledExceptionStrategy = UnhandledExceptionStrategy.LocalForceClose,
outdatedCommitmentStrategy = OutdatedCommitmentStrategy.RemoteClose,
unhandledExceptionStrategy = UnhandledExceptionStrategy.LocalClose,
db = TestDatabases.inMemoryDb(),
revocationTimeout = 20 seconds,
autoReconnect = false,
Expand Down

0 comments on commit a25bc6a

Please sign in to comment.