diff --git a/src/init.cpp b/src/init.cpp index 73b3c29c3b..4f4609f0c4 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -465,6 +465,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-minimumchainwork=", 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=", strprintf(_("Extra transactions to keep in memory for compact block reconstructions (default: %u)"), DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN)); strUsage += HelpMessageOpt("-par=", 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)); diff --git a/src/masternode/masternode-sync.cpp b/src/masternode/masternode-sync.cpp index d6154bacd3..6e73e459b7 100644 --- a/src/masternode/masternode-sync.cpp +++ b/src/masternode/masternode-sync.cpp @@ -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); diff --git a/src/validation.h b/src/validation.h index 9e23a456de..61946fc13e 100644 --- a/src/validation.h +++ b/src/validation.h @@ -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;