Skip to content

Commit

Permalink
Update eclair-core/src/main/scala/fr/acinq/eclair/Eclair.scala
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre-Marie Padiou <pm47@users.noreply.github.com>
  • Loading branch information
thomash-acinq and pm47 authored Nov 26, 2021
1 parent 42e3483 commit 4c8bd39
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eclair-core/src/main/scala/fr/acinq/eclair/Eclair.scala
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
private val externalIdMaxLength = 66

override def connect(target: Either[NodeURI, PublicKey])(implicit timeout: Timeout): Future[String] = target match {
case Left(uri) => appKit.switchboard.toTyped.ask((ref: typed.ActorRef[PeerConnection.ConnectionResult]) => Peer.Connect(uri, ref)).map(_.toString)
case Right(pubKey) => appKit.switchboard.toTyped.ask((ref: typed.ActorRef[PeerConnection.ConnectionResult]) => Peer.Connect(pubKey, None, ref)).map(_.toString)
implicit val typedScheduler: Scheduler = appKit.system.scheduler.toTyped
appKit.switchboard.toTyped
.ask[PeerConnection.ConnectionResult](ref => target.fold(
uri => Peer.Connect(uri, ref),
nodeId => Peer.Connect(nodeId, None, ref))
).map(_.toString)
}

override def disconnect(nodeId: PublicKey)(implicit timeout: Timeout): Future[String] = {
Expand Down

0 comments on commit 4c8bd39

Please sign in to comment.