Skip to content

Commit

Permalink
store start time in nodeParams
Browse files Browse the repository at this point in the history
  • Loading branch information
pm47 committed Oct 25, 2021
1 parent 8e085ac commit 875c74b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions eclair-core/src/main/scala/fr/acinq/eclair/NodeParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ case class NodeParams(nodeKeyManager: NodeKeyManager,
enableTrampolinePayment: Boolean,
balanceCheckInterval: FiniteDuration,
blockchainWatchdogSources: Seq[String]) {

val startTime: TimestampSecond = TimestampSecond.now()

val privateKey: Crypto.PrivateKey = nodeKeyManager.nodeKey.privateKey

val nodeId: PublicKey = nodeKeyManager.nodeId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import fr.acinq.eclair.transactions._
import fr.acinq.eclair.wire.protocol._
import scodec.bits.ByteVector

import java.lang.management.ManagementFactory
import java.sql.SQLException
import scala.collection.immutable.Queue
import scala.concurrent.ExecutionContext
Expand Down Expand Up @@ -2620,7 +2619,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder, remo

private def handleOutdatedCommitment(channelReestablish: ChannelReestablish, d: HasCommitments) = {
nodeParams.outdatedCommitmentStrategy match {
case OutdatedCommitmentStrategy.Stop if ManagementFactory.getRuntimeMXBean.getUptime.millis < 10.minutes =>
case OutdatedCommitmentStrategy.Stop if (TimestampSecond.now() - nodeParams.startTime) < 10.minutes =>
log.error("we just restarted and may have an outdated commitment: standard procedure would be to request our peer to force-close, but eclair has been configured to halt instead. Please ensure your database is up-to-date and restart eclair.")
System.exit(1)
stop(FSM.Shutdown)
Expand Down

0 comments on commit 875c74b

Please sign in to comment.