diff --git a/node-test/src/test/scala/org/bitcoins/node/networking/peer/DataMessageHandlerTest.scala b/node-test/src/test/scala/org/bitcoins/node/networking/peer/DataMessageHandlerTest.scala index e1ffdb95e8..cc77ef4bef 100644 --- a/node-test/src/test/scala/org/bitcoins/node/networking/peer/DataMessageHandlerTest.scala +++ b/node-test/src/test/scala/org/bitcoins/node/networking/peer/DataMessageHandlerTest.scala @@ -88,10 +88,10 @@ class DataMessageHandlerTest extends NodeTestWithCachedBitcoindNewest { } } - val nodeCallbacks = NodeCallbacks.onBlockReceived(callback) - node.nodeAppConfig.addCallbacks(nodeCallbacks) - for { + _ <- NodeTestUtil.awaitAllSync(node, bitcoind) + nodeCallbacks = NodeCallbacks.onBlockReceived(callback) + _ = node.nodeAppConfig.addCallbacks(nodeCallbacks) hash <- bitcoind.generateToAddress(blocks = 1, junkAddress).map(_.head) result = Await.result(resultP.future, 30.seconds) } yield assert(result.blockHeader.hashBE == hash)