Skip to content

Commit

Permalink
Update mempool space watcher test
Browse files Browse the repository at this point in the history
  • Loading branch information
sstone committed Oct 9, 2024
1 parent e7e15bf commit 9bb0a36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class MempoolSpaceClient(val mempoolUrl: Url, loggerFactory: LoggerFactory) : IC

companion object {
val OfficialMempoolMainnet = Url("https://mempool.space")
val OfficialMempoolTestnet = Url("https://mempool.space/testnet/")
val OfficialMempoolTestnet3 = Url("https://mempool.space/testnet/")
val OfficialMempoolTestnet4 = Url("https://mempool.space/testnet4/")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class MempoolSpaceWatcherTest : LightningTestSuite() {

val watch = WatchSpent(
channelId = randomBytes32(),
txId = TxId("b97167ea09da62daaa1d3198460fc4c204a553cb3e5c80ab48f5b75a870f15c5"),
outputIndex = 0,
txId = TxId("002f3246fa012ded792050f4a834e2eccdd772e1c7dc3a6a88cd6acdcbb9a2b2"),
outputIndex = 1,
publicKeyScript = ByteVector.empty,
event = BITCOIN_FUNDING_SPENT
)
watcher.watch(watch)
val event = assertIs<WatchEventSpent>(notifications.first())
assertEquals(TxId("5693d68997abfacb65cc7e6019e8ed2edb3f9f2260ae8d221e8726b8fe870ae0"), event.tx.txid)
assertEquals(TxId("8bce727fe08fbb79f02682f71d0b1f33a79039cd7a70623a51945bf2dc86d77c"), event.tx.txid)
// Right after checking whether the watched utxo is spent, a 2nd call is made by the watcher
// to find out whether the spending tx is confirmed, and the watch can be cleaned up. We give
// some time for that call to complete, in order to prevent a coroutine cancellation stack trace.
Expand All @@ -50,13 +50,13 @@ class MempoolSpaceWatcherTest : LightningTestSuite() {

val watch = WatchConfirmed(
channelId = randomBytes32(),
txId = TxId("5693d68997abfacb65cc7e6019e8ed2edb3f9f2260ae8d221e8726b8fe870ae0"),
txId = TxId("8bce727fe08fbb79f02682f71d0b1f33a79039cd7a70623a51945bf2dc86d77c"),
publicKeyScript = ByteVector.empty,
event = BITCOIN_FUNDING_DEPTHOK,
minDepth = 5
)
watcher.watch(watch)
val event = assertIs<WatchEventConfirmed>(notifications.first())
assertEquals(TxId("5693d68997abfacb65cc7e6019e8ed2edb3f9f2260ae8d221e8726b8fe870ae0"), event.tx.txid)
assertEquals(TxId("8bce727fe08fbb79f02682f71d0b1f33a79039cd7a70623a51945bf2dc86d77c"), event.tx.txid)
}
}

0 comments on commit 9bb0a36

Please sign in to comment.