Skip to content

Commit

Permalink
test: add tests for ElectrumClient::server_features method
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Jan 6, 2025
1 parent 61f1187 commit 90ab08f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.bitcoindevkit

import kotlin.test.Test
import kotlin.test.assertEquals
import org.rustbitcoin.bitcoin.Network
import org.bitcoindevkit.ServerFeaturesRes

private const val SIGNET_ELECTRUM_URL = "ssl://mempool.space:60602"

Expand Down Expand Up @@ -38,4 +40,16 @@ class LiveElectrumClientTest {
println("Received ${sentAndReceived.received.toSat()}")
}
}
}

@Test
fun testServerFeatures() {
val electrumClient: ElectrumClient = ElectrumClient("ssl://electrum.blockstream.info:60002")
val features: ServerFeaturesRes = electrumClient.serverFeatures()
println("Server Features:\n$features")

assertEquals(
expected = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
actual = features.genesisHash
)
}
}
11 changes: 11 additions & 0 deletions bdk-swift/Tests/BitcoinDevKitTests/LiveElectrumClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,15 @@ final class LiveElectrumClientTests: XCTestCase {
print("Received \(sentAndReceived.received.toSat())")
}
}

func testServerFeatures() throws {
let electrumClient: ElectrumClient = try ElectrumClient(url: "ssl://electrum.blockstream.info:60002")
let features: ServerFeaturesRes = try electrumClient.serverFeatures()
print("Server Features:\n\(features)")

XCTAssertEqual(
features.genesisHash,
"000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
)
}
}

0 comments on commit 90ab08f

Please sign in to comment.