Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sstone committed Apr 12, 2022
1 parent 76c0fff commit 974a73c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
8 changes: 4 additions & 4 deletions eclair-core/src/main/scala/fr/acinq/eclair/Eclair.scala
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ trait Eclair {

def sendOnionMessage(intermediateNodes: Seq[PublicKey], destination: Either[PublicKey, Sphinx.RouteBlinding.BlindedRoute], replyPath: Option[Seq[PublicKey]], userCustomContent: ByteVector)(implicit timeout: Timeout): Future[SendOnionMessageResponse]

def stop(exitCode: Int): Future[Unit]
def stop(): Future[Unit]
}

class EclairImpl(appKit: Kit) extends Eclair with Logging {
Expand Down Expand Up @@ -562,11 +562,11 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
}
}

override def stop(exitCode: Int): Future[Unit] = {
override def stop(): Future[Unit] = {
// README: do not make this smarter or more complex !
// eclair can simply and cleanly be stopped by killing its process without fear of losing data, payments, ... and it should remain this way.
logger.info(s"stopping eclair with exit code $exitCode")
sys.exit(exitCode)
logger.info("stopping eclair")
sys.exit(0)
Future.successful(())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ trait Node {
}

val stop: Route = postRequest("stop") { implicit t =>
formFields("exitCode".as[Int].?) { exitCode_opt =>
val exitCode = exitCode_opt.getOrElse(0)
eclairApi.stop(exitCode)
complete("ok")
}
complete(eclairApi.stop())
}

val nodeRoutes: Route = getInfo ~ connect ~ disconnect ~ peers ~ audit ~ stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,6 @@ class ApiServiceSpec extends AnyFunSuite with ScalatestRouteTest with IdiomaticM
test("stop eclair") {
val eclair = mock[Eclair]
val mockService = new MockService(eclair)
eclair.stop(0) returns Future.successful(())

Post("/stop") ~>
addCredentials(BasicHttpCredentials("", mockApi().password)) ~>
Expand Down

0 comments on commit 974a73c

Please sign in to comment.