mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-18 21:34:39 +01:00
Refactor NodeTestUtil.awaitSync() to check compact filter headers / compact filters as well (#4934)
This commit is contained in:
parent
bd79ab0b73
commit
746e23cf86
@ -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
|
||||
}
|
||||
|
@ -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 ()
|
||||
|
Loading…
Reference in New Issue
Block a user