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

Fix watcher flaky test #1883

Merged
merged 1 commit into from
Jul 16, 2021
Merged
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 @@ -243,6 +243,11 @@ class ZmqWatcherSpec extends TestKitBaseClass with AnyFunSuiteLike with Bitcoind
probe.expectMsg(tx2.txid)
listener.expectNoMessage(1 second)

// We must unsubscribe the watcher from ZMQ tx subscriptions, otherwise this test has a race condition because
// bitcoind sends us a NewTransaction event for each transaction inside a new block. If these are delayed and are
// received after we registered our watch, we will receive the watch-triggered event twice.
system.eventStream.unsubscribe(watcher.ref.toClassic, classOf[NewTransaction])

system.eventStream.subscribe(probe.ref, classOf[CurrentBlockCount])
generateBlocks(1)
awaitCond(probe.expectMsgType[CurrentBlockCount].blockCount >= initialBlockCount + 2)
Expand Down