Have BitcoindV21RpcClientTest wait for indexes to sync (#2855)

This commit is contained in:
benthecarman 2021-04-05 07:33:05 -05:00 committed by GitHub
parent 89e84fff67
commit d726c498d0

View File

@ -35,11 +35,14 @@ class BitcoindV21RpcClientTest extends BitcoindFixturesFundedCachedV21 {
}
it should "get index info" in { client: BitcoindV21RpcClient =>
def isHeight101(client: BitcoindRpcClient): Future[Boolean] = {
client.getBlockCount.map(_ == 101)
def indexSynced(client: BitcoindRpcClient): Future[Boolean] = {
client.getIndexInfo.map { indexes =>
indexes("txindex").best_block_height == 101 && indexes(
"basic block filter index").best_block_height == 101
}
}
for {
_ <- AsyncUtil.retryUntilSatisfiedF(() => isHeight101(client))
_ <- AsyncUtil.retryUntilSatisfiedF(() => indexSynced(client))
indexes <- client.getIndexInfo
} yield {
val txIndexInfo = indexes("txindex")