mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #7208
64360f1
Make max tip age an option instead of chainparam (Wladimir J. van der Laan)
This commit is contained in:
parent
723eacf454
commit
2474fd0aea
@ -133,7 +133,6 @@ public:
|
||||
pchMessageStart[3] = 0xbd;
|
||||
vAlertPubKey = ParseHex("048240a8748a80a286b270ba126705ced4f2ce5a7847b3610ea3c06513150dade2a8512ed5ea86320824683fc0818f0ac019214973e677acd1244f6d0571fc5103");
|
||||
nDefaultPort = 9999;
|
||||
nMaxTipAge = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin
|
||||
nDelayGetHeadersTime = 24 * 60 * 60;
|
||||
nPruneAfterHeight = 100000;
|
||||
|
||||
@ -269,7 +268,6 @@ public:
|
||||
pchMessageStart[3] = 0xff;
|
||||
vAlertPubKey = ParseHex("04517d8a699cb43d3938d7b24faaff7cda448ca4ea267723ba614784de661949bf632d6304316b244646dea079735b9a6fc4af804efb4752075b9fe2245e14e412");
|
||||
nDefaultPort = 19999;
|
||||
nMaxTipAge = 0x7fffffff; // allow mining on top of old blocks for testnet
|
||||
nDelayGetHeadersTime = 24 * 60 * 60;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
||||
@ -380,7 +378,6 @@ public:
|
||||
pchMessageStart[1] = 0xc1;
|
||||
pchMessageStart[2] = 0xb7;
|
||||
pchMessageStart[3] = 0xdc;
|
||||
nMaxTipAge = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin
|
||||
nDelayGetHeadersTime = 0; // never delay GETHEADERS in regtests
|
||||
nDefaultPort = 19994;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
@ -64,7 +64,6 @@ public:
|
||||
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
|
||||
/** Policy: Filter transactions that do not match well-defined patterns */
|
||||
bool RequireStandard() const { return fRequireStandard; }
|
||||
int64_t MaxTipAge() const { return nMaxTipAge; }
|
||||
int64_t DelayGetHeadersTime() const { return nDelayGetHeadersTime; }
|
||||
uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
||||
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
|
||||
@ -89,7 +88,6 @@ protected:
|
||||
//! Raw pub key bytes for the broadcast alert signing key.
|
||||
std::vector<unsigned char> vAlertPubKey;
|
||||
int nDefaultPort;
|
||||
long nMaxTipAge;
|
||||
int64_t nDelayGetHeadersTime;
|
||||
uint64_t nPruneAfterHeight;
|
||||
std::vector<CDNSSeedData> vSeeds;
|
||||
|
@ -567,6 +567,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)", DEFAULT_LIMITFREERELAY));
|
||||
strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", DEFAULT_RELAYPRIORITY));
|
||||
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE));
|
||||
strUsage += HelpMessageOpt("-maxtipage=<n>", strprintf("Maximum tip age in seconds to consider node in initial block download (default: %u)", DEFAULT_MAX_TIP_AGE));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)));
|
||||
@ -1209,6 +1210,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
if (GetBoolArg("-peerbloomfilters", true))
|
||||
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
|
||||
|
||||
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||
|
||||
fEnableReplacement = GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);
|
||||
if ((!fEnableReplacement) && mapArgs.count("-mempoolreplacement")) {
|
||||
// Minimal effort at forwards compatibility
|
||||
|
@ -83,6 +83,9 @@ bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
|
||||
size_t nCoinCacheUsage = 5000 * 300;
|
||||
uint64_t nPruneTarget = 0;
|
||||
bool fAlerts = DEFAULT_ALERTS;
|
||||
/* If the tip is older than this (in seconds), the node is considered to be in initial block download.
|
||||
*/
|
||||
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
|
||||
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
|
||||
|
||||
std::atomic<bool> fDIP0001WasLockedIn{false};
|
||||
@ -1308,7 +1311,7 @@ bool IsInitialBlockDownload()
|
||||
return true;
|
||||
if (chainActive.Tip()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork))
|
||||
return true;
|
||||
if (chainActive.Tip()->GetBlockTime() < (GetTime() - chainParams.MaxTipAge()))
|
||||
if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge))
|
||||
return true;
|
||||
lockIBDState = true;
|
||||
return false;
|
||||
|
@ -111,6 +111,7 @@ static const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 125000;
|
||||
|
||||
static const unsigned int DEFAULT_LIMITFREERELAY = 15;
|
||||
static const bool DEFAULT_RELAYPRIORITY = true;
|
||||
static const int64_t DEFAULT_MAX_TIP_AGE = 6 * 60 * 60; // ~144 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin
|
||||
|
||||
/** Default for -permitbaremultisig */
|
||||
static const bool DEFAULT_PERMIT_BAREMULTISIG = true;
|
||||
@ -156,6 +157,7 @@ extern bool fCheckpointsEnabled;
|
||||
extern size_t nCoinCacheUsage;
|
||||
extern CFeeRate minRelayTxFee;
|
||||
extern bool fAlerts;
|
||||
extern int64_t nMaxTipAge;
|
||||
extern bool fEnableReplacement;
|
||||
|
||||
extern bool fLargeWorkForkFound;
|
||||
|
Loading…
Reference in New Issue
Block a user