mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Sync mempool from other nodes on start (#3251)
* Sync mempool from other nodes on start * Add `-syncmempool` cmd-line option to be able to disable mempool sync if needed * Only sync mempool with outbound peers Co-authored-by: Alexander Block <ablock84@gmail.com>
This commit is contained in:
parent
474f25b8dc
commit
8e054f3742
@ -465,6 +465,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-minimumchainwork=<hex>", strprintf("Minimum work assumed to exist on a valid chain in hex (default: %s, testnet: %s)", defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnetChainParams->GetConsensus().nMinimumChainWork.GetHex()));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-persistmempool", strprintf(_("Whether to save the mempool on shutdown and load on restart (default: %u)"), DEFAULT_PERSIST_MEMPOOL));
|
||||
strUsage += HelpMessageOpt("-syncmempool", strprintf(_("Sync mempool from other nodes on start (default: %u)"), DEFAULT_SYNC_MEMPOOL));
|
||||
strUsage += HelpMessageOpt("-blockreconstructionextratxn=<n>", strprintf(_("Extra transactions to keep in memory for compact block reconstructions (default: %u)"), DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN));
|
||||
strUsage += HelpMessageOpt("-par=<n>", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"),
|
||||
-GetNumCores(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS));
|
||||
|
@ -208,6 +208,12 @@ void CMasternodeSync::ProcessTick(CConnman& connman)
|
||||
// INITIAL TIMEOUT
|
||||
|
||||
if(nCurrentAsset == MASTERNODE_SYNC_WAITING) {
|
||||
if(!pnode->fInbound && gArgs.GetBoolArg("-syncmempool", DEFAULT_SYNC_MEMPOOL) && !netfulfilledman.HasFulfilledRequest(pnode->addr, "mempool-sync")) {
|
||||
netfulfilledman.AddFulfilledRequest(pnode->addr, "mempool-sync");
|
||||
connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MEMPOOL));
|
||||
LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nCurrentAsset %d -- syncing mempool from peer=%d\n", nTick, nCurrentAsset, pnode->GetId());
|
||||
}
|
||||
|
||||
if(GetTime() - nTimeLastBumped > MASTERNODE_SYNC_TIMEOUT_SECONDS) {
|
||||
// At this point we know that:
|
||||
// a) there are peers (because we are looping on at least one of them);
|
||||
|
@ -137,6 +137,8 @@ static const bool DEFAULT_SPENTINDEX = false;
|
||||
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
|
||||
/** Default for -persistmempool */
|
||||
static const bool DEFAULT_PERSIST_MEMPOOL = true;
|
||||
/** Default for -syncmempool */
|
||||
static const bool DEFAULT_SYNC_MEMPOOL = true;
|
||||
|
||||
/** Maximum number of headers to announce when relaying blocks with headers message.*/
|
||||
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;
|
||||
|
Loading…
Reference in New Issue
Block a user