mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-20 02:27:32 +01:00
Update electrum testnet server list, and fix flaky client pool tests (#609)
* electrum: update testnet server list * electrum: filter out onion addresses * electrum pool test: wait until we have a stable master server
This commit is contained in:
parent
d875007862
commit
7b5b665fe9
@ -1,15 +1,31 @@
|
||||
{
|
||||
"testnetnode.arihanc.com": {
|
||||
"t": "51001",
|
||||
"s": "51002"
|
||||
},
|
||||
"testnet.hsmiths.com": {
|
||||
"t": "53011",
|
||||
"s": "53012"
|
||||
},
|
||||
"testnet.qtornado.com": {
|
||||
"t": "51001",
|
||||
"s": "51002"
|
||||
}
|
||||
"electrumx.kekku.li": {
|
||||
"pruning": "-",
|
||||
"s": "51002",
|
||||
"version": "1.2"
|
||||
},
|
||||
"hsmithsxurybd7uh.onion": {
|
||||
"pruning": "-",
|
||||
"s": "53012",
|
||||
"t": "53011",
|
||||
"version": "1.2"
|
||||
},
|
||||
"testnet.hsmiths.com": {
|
||||
"pruning": "-",
|
||||
"s": "53012",
|
||||
"t": "53011",
|
||||
"version": "1.2"
|
||||
},
|
||||
"testnet.qtornado.com": {
|
||||
"pruning": "-",
|
||||
"s": "51002",
|
||||
"t": "51001",
|
||||
"version": "1.2"
|
||||
},
|
||||
"testnet1.bauerj.eu": {
|
||||
"pruning": "-",
|
||||
"s": "50002",
|
||||
"t": "50001",
|
||||
"version": "1.2"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ import scala.concurrent.duration._
|
||||
import scala.util.Random
|
||||
|
||||
class ElectrumClientPool(serverAddresses: Set[InetSocketAddress])(implicit val ec: ExecutionContext) extends Actor with FSM[ElectrumClientPool.State, ElectrumClientPool.Data] {
|
||||
|
||||
import ElectrumClientPool._
|
||||
|
||||
val statusListeners = collection.mutable.HashSet.empty[ActorRef]
|
||||
@ -163,11 +162,12 @@ object ElectrumClientPool {
|
||||
def readServerAddresses(stream: InputStream): Set[InetSocketAddress] = try {
|
||||
val JObject(values) = JsonMethods.parse(stream)
|
||||
val addresses = values.flatMap {
|
||||
case (name, fields) =>
|
||||
case (name, fields) if !name.endsWith(".onion") =>
|
||||
fields \ "t" match {
|
||||
case JString(port) => Some(InetSocketAddress.createUnresolved(name, port.toInt))
|
||||
case _ => None // we only support raw TCP (not SSL) connection to electrum servers for now
|
||||
}
|
||||
case _ => None
|
||||
}
|
||||
addresses.toSet
|
||||
} finally {
|
||||
|
@ -49,8 +49,12 @@ class ElectrumClientPoolSpec extends TestKit(ActorSystem("test")) with FunSuiteL
|
||||
|
||||
test("connect to an electrumx testnet server") {
|
||||
probe.send(router, AddStatusListener(probe.ref))
|
||||
probe.expectMsgType[ElectrumReady](15 seconds)
|
||||
}
|
||||
// make sure our master is stable, if the first master that we select is behind the other servers we will switch
|
||||
// during the first few seconds
|
||||
awaitCond({
|
||||
probe.expectMsgType[ElectrumReady]
|
||||
probe.receiveOne(5 seconds) == null
|
||||
}, max = 15 seconds, interval = 1000 millis) }
|
||||
|
||||
test("get transaction") {
|
||||
probe.send(router, GetTransaction("c5efb5cbd35a44ba956b18100be0a91c9c33af4c7f31be20e33741d95f04e202"))
|
||||
|
Loading…
Reference in New Issue
Block a user