diff --git a/lnd-rpc/src/main/scala/org/bitcoins/lnd/rpc/config/LndConfig.scala b/lnd-rpc/src/main/scala/org/bitcoins/lnd/rpc/config/LndConfig.scala index e566aaf409..c70f89f70e 100644 --- a/lnd-rpc/src/main/scala/org/bitcoins/lnd/rpc/config/LndConfig.scala +++ b/lnd-rpc/src/main/scala/org/bitcoins/lnd/rpc/config/LndConfig.scala @@ -101,11 +101,20 @@ case class LndConfig(private[bitcoins] val lines: Seq[String], datadir: File) else "http://" + baseUrl }) - lazy val rpcBinding: URI = new URI({ - val baseUrl = getValue("rpclisten").getOrElse("127.0.0.1:10009") - if (baseUrl.startsWith("http")) baseUrl - else "http://" + baseUrl - }) + lazy val rpcBinding: URI = { + val uri = new URI({ + val baseUrl = getValue("rpclisten").getOrElse("127.0.0.1:10009") + if (baseUrl.startsWith("http")) baseUrl + else "http://" + baseUrl + }) + + // if our local lnd is bound to 0.0.0.0 + // then we can just make requests to localhost + if (uri.getHost == "0.0.0.0") { + logger.warn("lnd rpc is bound to 0.0.0.0, using localhost instead") + new URI(s"http://127.0.0.1:${uri.getPort}") + } else uri + } lazy val restBinding: URI = new URI({ val baseUrl = getValue("restlisten").getOrElse("127.0.0.1:8080") diff --git a/testkit/src/main/scala/org/bitcoins/testkit/lnd/LndRpcTestUtil.scala b/testkit/src/main/scala/org/bitcoins/testkit/lnd/LndRpcTestUtil.scala index bff5a2fd9d..a5f9a00457 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/lnd/LndRpcTestUtil.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/lnd/LndRpcTestUtil.scala @@ -79,7 +79,12 @@ trait LndRpcTestUtil extends Logging { |historicalsyncinterval=1s |trickledelay=1000 |listen=127.0.0.1:$port - |rpclisten=127.0.0.1:$rpcPort + | + |# allow requests from docker containers + |tlsextradomain=host.docker.internal + |tlsextradomain=host-gateway + |rpclisten=0.0.0.0:$rpcPort + | |externalip=127.0.0.1 |maxpendingchannels=10 |bitcoind.rpcuser = ${bitcoindInstance.authCredentials