Refactor NodeTestUtil.awaitSync() to check compact filter headers / compact filters as well (#4934)

This commit is contained in:
Chris Stewart 2022-12-29 10:36:37 -06:00 committed by GitHub
parent bd79ab0b73
commit 746e23cf86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -112,7 +112,8 @@ class NeutrinoNodeWithUncachedBitcoindTest extends NodeUnitTest with CachedTor {
//out of sync by 1 block, h2 ahead
_ = assert(h2 - h1 == 1)
_ <- node.sync()
_ <- NodeTestUtil.awaitSync(node, bitcoinds(1))
bestHash <- bitcoinds(1).getBestBlockHash
_ <- NodeTestUtil.awaitBestHash(bestHash, node)
} yield {
succeed
}

View File

@ -138,13 +138,9 @@ abstract class NodeTestUtil extends P2PLogger {
private val syncTries: Int = 15
/** Awaits sync between the given node and bitcoind client */
def awaitSync(node: Node, rpc: BitcoindRpcClient)(implicit
def awaitSync(node: NeutrinoNode, rpc: BitcoindRpcClient)(implicit
sys: ActorSystem): Future[Unit] = {
import sys.dispatcher
TestAsyncUtil
.retryUntilSatisfiedF(() => isSameBestHash(node, rpc),
1.second,
maxTries = syncTries)
awaitAllSync(node, rpc)
}
/** Awaits sync between the given node and bitcoind client */
@ -185,7 +181,8 @@ abstract class NodeTestUtil extends P2PLogger {
system: ActorSystem): Future[Unit] = {
import system.dispatcher
for {
_ <- NodeTestUtil.awaitSync(node, bitcoind)
bitcoindBestHash <- bitcoind.getBestBlockHash
_ <- NodeTestUtil.awaitBestHash(bitcoindBestHash, node)
_ <- NodeTestUtil.awaitCompactFilterHeadersSync(node, bitcoind)
_ <- NodeTestUtil.awaitCompactFiltersSync(node, bitcoind)
} yield ()