diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include // boost::thread::interrupt @@ -365,6 +366,21 @@ return ret; } +UniValue syncwithvalidationinterfacequeue(const Config &config, + const JSONRPCRequest &request) { + if (request.fHelp || request.params.size() > 0) { + throw std::runtime_error( + "syncwithvalidationinterfacequeue\n" + "\nWaits for the validation interface queue to catch up on " + "everything that was there when we entered this function.\n" + "\nExamples:\n" + + HelpExampleCli("syncwithvalidationinterfacequeue", "") + + HelpExampleRpc("syncwithvalidationinterfacequeue", "")); + } + SyncWithValidationInterfaceQueue(); + return NullUniValue; +} + UniValue getdifficulty(const Config &config, const JSONRPCRequest &request) { if (request.fHelp || request.params.size() != 0) { throw std::runtime_error("getdifficulty\n" @@ -1854,15 +1870,16 @@ { "blockchain", "preciousblock", preciousblock, {"blockhash"} }, /* Not shown in help */ - { "hidden", "getfinalizedblockhash", getfinalizedblockhash, {} }, - { "hidden", "finalizeblock", finalizeblock, {"blockhash"} }, - { "hidden", "invalidateblock", invalidateblock, {"blockhash"} }, - { "hidden", "parkblock", parkblock, {"blockhash"} }, - { "hidden", "reconsiderblock", reconsiderblock, {"blockhash"} }, - { "hidden", "unparkblock", unparkblock, {"blockhash"} }, - { "hidden", "waitfornewblock", waitfornewblock, {"timeout"} }, - { "hidden", "waitforblock", waitforblock, {"blockhash","timeout"} }, - { "hidden", "waitforblockheight", waitforblockheight, {"height","timeout"} }, + { "hidden", "getfinalizedblockhash", getfinalizedblockhash, {} }, + { "hidden", "finalizeblock", finalizeblock, {"blockhash"} }, + { "hidden", "invalidateblock", invalidateblock, {"blockhash"} }, + { "hidden", "parkblock", parkblock, {"blockhash"} }, + { "hidden", "reconsiderblock", reconsiderblock, {"blockhash"} }, + { "hidden", "syncwithvalidationinterfacequeue", syncwithvalidationinterfacequeue, {} }, + { "hidden", "unparkblock", unparkblock, {"blockhash"} }, + { "hidden", "waitfornewblock", waitfornewblock, {"timeout"} }, + { "hidden", "waitforblock", waitforblock, {"blockhash","timeout"} }, + { "hidden", "waitforblockheight", waitforblockheight, {"height","timeout"} }, }; // clang-format on diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -446,7 +446,7 @@ raise AssertionError("Chain sync failed: Best block hashes don't match") -def sync_mempools(rpc_connections, *, wait=1, timeout=60): +def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True): """ Wait until everybody has the same transactions in their memory pools @@ -458,6 +458,9 @@ if set(rpc_connections[i].getrawmempool()) == pool: num_match = num_match + 1 if num_match == len(rpc_connections): + if flush_scheduler: + for r in rpc_connections: + r.syncwithvalidationinterfacequeue() return time.sleep(wait) timeout -= wait