mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-11 15:48:05 +00:00
qa: Sync with validationinterface queue in sync_mempools
This commit is contained in:
parent
66e3af709d
commit
fa1e69e52b
@ -24,6 +24,7 @@
|
|||||||
#include <util.h>
|
#include <util.h>
|
||||||
#include <utilstrencodings.h>
|
#include <utilstrencodings.h>
|
||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
|
#include <validationinterface.h>
|
||||||
#include <warnings.h>
|
#include <warnings.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -323,6 +324,21 @@ UniValue waitforblockheight(const JSONRPCRequest& request)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniValue syncwithvalidationinterfacequeue(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 JSONRPCRequest& request)
|
UniValue getdifficulty(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
@ -1628,6 +1644,7 @@ static const CRPCCommand commands[] =
|
|||||||
{ "hidden", "waitfornewblock", &waitfornewblock, {"timeout"} },
|
{ "hidden", "waitfornewblock", &waitfornewblock, {"timeout"} },
|
||||||
{ "hidden", "waitforblock", &waitforblock, {"blockhash","timeout"} },
|
{ "hidden", "waitforblock", &waitforblock, {"blockhash","timeout"} },
|
||||||
{ "hidden", "waitforblockheight", &waitforblockheight, {"height","timeout"} },
|
{ "hidden", "waitforblockheight", &waitforblockheight, {"height","timeout"} },
|
||||||
|
{ "hidden", "syncwithvalidationinterfacequeue", &syncwithvalidationinterfacequeue, {} },
|
||||||
};
|
};
|
||||||
|
|
||||||
void RegisterBlockchainRPCCommands(CRPCTable &t)
|
void RegisterBlockchainRPCCommands(CRPCTable &t)
|
||||||
|
@ -390,7 +390,7 @@ def sync_chain(rpc_connections, *, wait=1, timeout=60):
|
|||||||
timeout -= wait
|
timeout -= wait
|
||||||
raise AssertionError("Chain sync failed: Best block hashes don't match")
|
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
|
Wait until everybody has the same transactions in their memory
|
||||||
pools
|
pools
|
||||||
@ -402,6 +402,9 @@ def sync_mempools(rpc_connections, *, wait=1, timeout=60):
|
|||||||
if set(rpc_connections[i].getrawmempool()) == pool:
|
if set(rpc_connections[i].getrawmempool()) == pool:
|
||||||
num_match = num_match + 1
|
num_match = num_match + 1
|
||||||
if num_match == len(rpc_connections):
|
if num_match == len(rpc_connections):
|
||||||
|
if flush_scheduler:
|
||||||
|
for r in rpc_connections:
|
||||||
|
r.syncwithvalidationinterfacequeue()
|
||||||
return
|
return
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
timeout -= wait
|
timeout -= wait
|
||||||
|
Loading…
Reference in New Issue
Block a user