Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use testnet4 for electrum tests instead of testnet3 #733

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import fr.acinq.lightning.tests.utils.testLoggerFactory
import fr.acinq.lightning.utils.ServerAddress
import kotlinx.coroutines.CoroutineScope

val ElectrumTestnetServerAddress = ServerAddress("testnet1.electrum.acinq.co", 51002, TcpSocket.TLS.UNSAFE_CERTIFICATES)
val ElectrumTestnet4ServerAddress = ServerAddress("mempool.space", 40002, TcpSocket.TLS.UNSAFE_CERTIFICATES)
val ElectrumMainnetServerAddress = ServerAddress("electrum.acinq.co", 50002, TcpSocket.TLS.UNSAFE_CERTIFICATES)

suspend fun connectToElectrumServer(scope: CoroutineScope, addr: ServerAddress): ElectrumClient =
ElectrumClient(scope, testLoggerFactory).apply { connect(addr, TcpSocket.Builder()) }

suspend fun CoroutineScope.connectToTestnetServer(): ElectrumClient = connectToElectrumServer(this, ElectrumTestnetServerAddress)
suspend fun CoroutineScope.connectToTestnet4Server(): ElectrumClient = connectToElectrumServer(this, ElectrumTestnet4ServerAddress)

suspend fun CoroutineScope.connectToMainnetServer(): ElectrumClient = connectToElectrumServer(this, ElectrumMainnetServerAddress)
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class SwapInWalletTestsCommon : LightningTestSuite() {
@Test
fun `swap-in wallet test`() = runSuspendTest(timeout = 15.seconds) {
val mnemonics = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about".split(" ")
val keyManager = LocalKeyManager(MnemonicCode.toSeed(mnemonics, "").toByteVector(), Chain.Testnet3, TestConstants.aliceSwapInServerXpub)
val client = connectToTestnetServer()
val wallet = SwapInWallet(Chain.Testnet3, keyManager.swapInOnChainWallet, client, this, loggerFactory)
val keyManager = LocalKeyManager(MnemonicCode.toSeed(mnemonics, "").toByteVector(), Chain.Testnet4, TestConstants.aliceSwapInServerXpub)
val client = connectToTestnet4Server()
val wallet = SwapInWallet(Chain.Testnet4, keyManager.swapInOnChainWallet, client, this, loggerFactory)

// addresses 0 to 3 have funds on them, the current address is the 4th
assertEquals(4, wallet.swapInAddressFlow.filterNotNull().first().second)
Expand Down