Add rpc for syncwithvalidationinterfacequeue, use it in NodeUnitTest.syncNeutrinoNode (#4983)

This commit is contained in:
Chris Stewart 2023-02-11 14:32:59 -06:00 committed by GitHub
parent 0ff1370bf9
commit b329c3670e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -253,4 +253,12 @@ trait BlockchainRpc { self: Client =>
bitcoindCall[Boolean]("verifychain",
List(JsNumber(level), JsNumber(blocks)))
}
/** Waits for the validation interface queue to catch up on everything that was there when we entered this function
* @see [[https://github.com/bitcoin/bitcoin/issues/27085]]
* @return
*/
def syncWithValidationInterfaceQueue(): Future[Unit] = {
bitcoindCall[Unit](command = "syncwithvalidationinterfacequeue", List.empty)
}
}

View File

@ -532,6 +532,10 @@ object NodeUnitTest extends P2PLogger {
system: ActorSystem): Future[NeutrinoNode] = {
import system.dispatcher
for {
//wait for bitcoind to be synced internally
//see: https://github.com/bitcoin/bitcoin/issues/27085
//see: https://github.com/bitcoin-s/bitcoin-s/issues/4976
_ <- bitcoind.syncWithValidationInterfaceQueue()
_ <- node.sync()
syncing <- node.chainApiFromDb().flatMap(_.isSyncing())
_ = require(syncing)