diff --git a/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala b/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala index 26793082fb..d1b52b257b 100644 --- a/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala +++ b/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala @@ -10,6 +10,7 @@ import org.bitcoins.tor.{Socks5Connection, Socks5ProxyParams} import java.io.IOException import java.net.InetSocketAddress +import scala.concurrent.duration.DurationInt import scala.concurrent.{Future, Promise} class DLCClient( @@ -36,7 +37,14 @@ class DLCClient( remoteAddress } context.become(connecting(peer)) - IO(Tcp) ! Tcp.Connect(peerOrProxyAddress) + + //currently our request timeout for requests sent to the backend is 60 seconds + //so we need the connection timeout to occur before the request times out + //when a user tries to submit an accept to the backend + //see: https://github.com/bitcoin-s/bitcoin-s/issues/4080 + val connectionTimeout = 45.seconds + IO(Tcp) ! Tcp.Connect(peerOrProxyAddress, + timeout = Some(connectionTimeout)) } def connecting(peer: Peer): Receive = LoggingReceive { @@ -44,7 +52,6 @@ class DLCClient( val ex = c.cause.getOrElse(new IOException("Unknown Error")) log.error(s"Cannot connect to ${cmd.remoteAddress} ", ex) throw ex - case Tcp.Connected(peerOrProxyAddress, _) => val connection = sender() peer.socks5ProxyParams match {