Skip to content

Commit

Permalink
ugly
Browse files Browse the repository at this point in the history
  • Loading branch information
thomash-acinq committed Nov 26, 2021
1 parent 502aa7b commit 473ad4e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 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,8 @@ 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 ? Peer.Connect(uri, appKit.switchboard)).mapTo[PeerConnection.ConnectionResult].map(_.toString)
case Right(pubKey) => (appKit.switchboard ? Peer.Connect(pubKey, None, appKit.switchboard)).mapTo[PeerConnection.ConnectionResult].map(_.toString)
case Left(uri) => (appKit.switchboard ? Peer.Connect(uri, ActorRef.noSender)).mapTo[PeerConnection.ConnectionResult].map(_.toString)
case Right(pubKey) => (appKit.switchboard ? Peer.Connect(pubKey, None, ActorRef.noSender)).mapTo[PeerConnection.ConnectionResult].map(_.toString)
}

override def disconnect(nodeId: PublicKey)(implicit timeout: Timeout): Future[String] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ class Switchboard(nodeParams: NodeParams, peerFactory: Switchboard.PeerFactory)
case Peer.Connect(publicKey, _, _) if publicKey == nodeParams.nodeId =>
sender() ! Status.Failure(new RuntimeException("cannot open connection with oneself"))

case c: Peer.Connect =>
case Peer.Connect(nodeId, address_opt, replyTo) =>
// we create a peer if it doesn't exist
val peer = createOrGetPeer(c.nodeId, offlineChannels = Set.empty)
val peer = createOrGetPeer(nodeId, offlineChannels = Set.empty)
val c = if (replyTo == ActorRef.noSender){
Peer.Connect(nodeId, address_opt, sender())
}else{
Peer.Connect(nodeId, address_opt, replyTo)
}
peer forward c

case d: Peer.Disconnect =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

package fr.acinq.eclair.integration

import akka.actor.typed.scaladsl.adapter.ClassicActorRefOps
import akka.testkit.TestProbe
import akka.util.Timeout
import com.google.common.net.HostAndPort
import com.typesafe.config.ConfigFactory
import fr.acinq.bitcoin.Satoshi
import fr.acinq.eclair.blockchain.bitcoind.ZmqWatcher
import fr.acinq.eclair.blockchain.bitcoind.ZmqWatcher.{Watch, WatchFundingConfirmed}
import fr.acinq.eclair.channel.{ChannelStateChanged, NORMAL}
import fr.acinq.eclair.channel.ChannelStateChanged
import fr.acinq.eclair.io.NodeURI
import fr.acinq.eclair.message.OnionMessages
import fr.acinq.eclair.router.Router
Expand Down

0 comments on commit 473ad4e

Please sign in to comment.