Make max tip age an option instead of chainparam
After discussion in #7164 I think this is better. Max tip age was introduced in #5987 to make it possible to run testnet-in-a-box. But associating this behavior with the testnet chain is wrong conceptually, as it is not needed in normal usage. Should aim to make testnet test the software as-is. Replace it with a (debug) option `-maxtipage`, which can be specified only in the specific case.
This commit is contained in:
committed by
Jack Grigg
parent
75546c697a
commit
29aaf13b0a
@@ -115,7 +115,6 @@ public:
|
|||||||
pchMessageStart[3] = 0x64;
|
pchMessageStart[3] = 0x64;
|
||||||
vAlertPubKey = ParseHex("04b7ecf0baa90495ceb4e4090f6b2fd37eec1e9c85fac68a487f3ce11589692e4a317479316ee814e066638e1db54e37a10689b70286e6315b1087b6615d179264");
|
vAlertPubKey = ParseHex("04b7ecf0baa90495ceb4e4090f6b2fd37eec1e9c85fac68a487f3ce11589692e4a317479316ee814e066638e1db54e37a10689b70286e6315b1087b6615d179264");
|
||||||
nDefaultPort = 8233;
|
nDefaultPort = 8233;
|
||||||
nMaxTipAge = 24 * 60 * 60;
|
|
||||||
nPruneAfterHeight = 100000;
|
nPruneAfterHeight = 100000;
|
||||||
const size_t N = 200, K = 9;
|
const size_t N = 200, K = 9;
|
||||||
BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
|
BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
|
||||||
@@ -275,7 +274,6 @@ public:
|
|||||||
pchMessageStart[3] = 0xbf;
|
pchMessageStart[3] = 0xbf;
|
||||||
vAlertPubKey = ParseHex("044e7a1553392325c871c5ace5d6ad73501c66f4c185d6b0453cf45dec5a1322e705c672ac1a27ef7cdaf588c10effdf50ed5f95f85f2f54a5f6159fca394ed0c6");
|
vAlertPubKey = ParseHex("044e7a1553392325c871c5ace5d6ad73501c66f4c185d6b0453cf45dec5a1322e705c672ac1a27ef7cdaf588c10effdf50ed5f95f85f2f54a5f6159fca394ed0c6");
|
||||||
nDefaultPort = 18233;
|
nDefaultPort = 18233;
|
||||||
nMaxTipAge = 24 * 60 * 60;
|
|
||||||
nPruneAfterHeight = 1000;
|
nPruneAfterHeight = 1000;
|
||||||
const size_t N = 200, K = 9;
|
const size_t N = 200, K = 9;
|
||||||
BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
|
BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
|
||||||
@@ -387,7 +385,6 @@ public:
|
|||||||
pchMessageStart[2] = 0x3f;
|
pchMessageStart[2] = 0x3f;
|
||||||
pchMessageStart[3] = 0x5f;
|
pchMessageStart[3] = 0x5f;
|
||||||
nDefaultPort = 18344;
|
nDefaultPort = 18344;
|
||||||
nMaxTipAge = 24 * 60 * 60;
|
|
||||||
nPruneAfterHeight = 1000;
|
nPruneAfterHeight = 1000;
|
||||||
const size_t N = 48, K = 5;
|
const size_t N = 48, K = 5;
|
||||||
BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
|
BOOST_STATIC_ASSERT(equihash_parameters_acceptable(N, K));
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public:
|
|||||||
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
|
bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
|
||||||
/** Policy: Filter transactions that do not match well-defined patterns */
|
/** Policy: Filter transactions that do not match well-defined patterns */
|
||||||
bool RequireStandard() const { return fRequireStandard; }
|
bool RequireStandard() const { return fRequireStandard; }
|
||||||
int64_t MaxTipAge() const { return nMaxTipAge; }
|
|
||||||
int64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
int64_t PruneAfterHeight() const { return nPruneAfterHeight; }
|
||||||
unsigned int EquihashN() const { return nEquihashN; }
|
unsigned int EquihashN() const { return nEquihashN; }
|
||||||
unsigned int EquihashK() const { return nEquihashK; }
|
unsigned int EquihashK() const { return nEquihashK; }
|
||||||
@@ -97,7 +96,6 @@ protected:
|
|||||||
//! Raw pub key bytes for the broadcast alert signing key.
|
//! Raw pub key bytes for the broadcast alert signing key.
|
||||||
std::vector<unsigned char> vAlertPubKey;
|
std::vector<unsigned char> vAlertPubKey;
|
||||||
int nDefaultPort = 0;
|
int nDefaultPort = 0;
|
||||||
long nMaxTipAge = 0;
|
|
||||||
uint64_t nPruneAfterHeight = 0;
|
uint64_t nPruneAfterHeight = 0;
|
||||||
unsigned int nEquihashN = 0;
|
unsigned int nEquihashN = 0;
|
||||||
unsigned int nEquihashK = 0;
|
unsigned int nEquihashK = 0;
|
||||||
|
|||||||
@@ -472,6 +472,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||||||
strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)", 15));
|
strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)", 15));
|
||||||
strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", 0));
|
strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", 0));
|
||||||
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> entries (default: %u)", 50000));
|
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> entries (default: %u)", 50000));
|
||||||
|
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 (default: %s)"),
|
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)"),
|
||||||
CURRENCY_UNIT, FormatMoney(::minRelayTxFee.GetFeePerK())));
|
CURRENCY_UNIT, FormatMoney(::minRelayTxFee.GetFeePerK())));
|
||||||
@@ -1077,6 +1078,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (GetBoolArg("-peerbloomfilters", true))
|
if (GetBoolArg("-peerbloomfilters", true))
|
||||||
nLocalServices |= NODE_BLOOM;
|
nLocalServices |= NODE_BLOOM;
|
||||||
|
|
||||||
|
nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||||
|
|
||||||
#ifdef ENABLE_MINING
|
#ifdef ENABLE_MINING
|
||||||
if (mapArgs.count("-mineraddress")) {
|
if (mapArgs.count("-mineraddress")) {
|
||||||
CTxDestination addr = DecodeDestination(mapArgs["-mineraddress"]);
|
CTxDestination addr = DecodeDestination(mapArgs["-mineraddress"]);
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ bool fCoinbaseEnforcedProtectionEnabled = true;
|
|||||||
size_t nCoinCacheUsage = 5000 * 300;
|
size_t nCoinCacheUsage = 5000 * 300;
|
||||||
uint64_t nPruneTarget = 0;
|
uint64_t nPruneTarget = 0;
|
||||||
bool fAlerts = DEFAULT_ALERTS;
|
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;
|
||||||
|
|
||||||
unsigned int expiryDelta = DEFAULT_TX_EXPIRY_DELTA;
|
unsigned int expiryDelta = DEFAULT_TX_EXPIRY_DELTA;
|
||||||
|
|
||||||
@@ -1733,7 +1736,7 @@ bool IsInitialBlockDownload()
|
|||||||
if (lockIBDState)
|
if (lockIBDState)
|
||||||
return false;
|
return false;
|
||||||
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
|
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
|
||||||
pindexBestHeader->GetBlockTime() < GetTime() - chainParams.MaxTipAge());
|
pindexBestHeader->GetBlockTime() < GetTime() - nMaxTipAge);
|
||||||
if (!state)
|
if (!state)
|
||||||
lockIBDState = true;
|
lockIBDState = true;
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60;
|
|||||||
static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60;
|
static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60;
|
||||||
/** Maximum length of reject messages. */
|
/** Maximum length of reject messages. */
|
||||||
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111;
|
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111;
|
||||||
|
static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60;
|
||||||
|
|
||||||
// Sanity check the magic numbers when we change them
|
// Sanity check the magic numbers when we change them
|
||||||
BOOST_STATIC_ASSERT(DEFAULT_BLOCK_MAX_SIZE <= MAX_BLOCK_SIZE);
|
BOOST_STATIC_ASSERT(DEFAULT_BLOCK_MAX_SIZE <= MAX_BLOCK_SIZE);
|
||||||
@@ -137,6 +138,7 @@ extern bool fCoinbaseEnforcedProtectionEnabled;
|
|||||||
extern size_t nCoinCacheUsage;
|
extern size_t nCoinCacheUsage;
|
||||||
extern CFeeRate minRelayTxFee;
|
extern CFeeRate minRelayTxFee;
|
||||||
extern bool fAlerts;
|
extern bool fAlerts;
|
||||||
|
extern int64_t nMaxTipAge;
|
||||||
|
|
||||||
/** Best header we've seen so far (used for getheaders queries' starting points). */
|
/** Best header we've seen so far (used for getheaders queries' starting points). */
|
||||||
extern CBlockIndex *pindexBestHeader;
|
extern CBlockIndex *pindexBestHeader;
|
||||||
|
|||||||
Reference in New Issue
Block a user