You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
argsman.AddArg("-txindex", strprintf("Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)", DEFAULT_TXINDEX), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
428
+
argsman.AddArg("-trim_headers", strprintf("Trim old headers in memory (by default older than 2 epochs), removing blocksigning and dynafed-related fields. Saves memory, but blocks us from serving blocks or headers to peers, and removes trimmed fields from some JSON RPC outputs. (default: false)"), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
428
429
argsman.AddArg("-blockfilterindex=<type>",
429
430
strprintf("Maintain an index of compact filters by block (default: %s, values: %s).", DEFAULT_BLOCKFILTERINDEX, ListBlockFilterTypes()) +
430
431
" If <type> is not supplied or if <type> = 1, indexes for all known types are enabled.",
if (epoch_length == std::numeric_limits<uint32_t>::max()) {
985
+
// That's the default value, for non-dynafed chains and some tests. Pick a more sensible default here.
986
+
epoch_length = 20160;
987
+
}
988
+
989
+
if (args.IsArgSet("-trim_headers")) {
990
+
LogPrintf("Configured for header-trimming mode. This will reduce memory usage substantially, but we will be unable to serve as a full P2P peer, and certain header fields may be missing from JSON RPC output.\n");
991
+
fTrimHeaders = true;
992
+
// This calculation is driven by GetValidFedpegScripts in pegins.cpp, which walks the chain
993
+
// back to current epoch start, and then an additional total_valid_epochs on top of that.
994
+
// We add one epoch here for the current partial epoch, and then another one for good luck.
// Our notion of what blocks a peer has available is based on its pindexBestKnownBlock,
2026
+
// which is based on headers recieved from it. If we don't have one, or it's too old,
2027
+
// then we can never get blocks from this peer until we accept headers from it first.
2028
+
LogPrint(BCLog::NET, "NOT discarding headers from peer=%d, to update its block availability. (current best header %d, active chain height %d)\n", pfrom.GetId(), pindexBestHeader->nHeight, m_chainman.ActiveHeight());
2029
+
} else {
2030
+
LogPrint(BCLog::NET, "Discarding received headers and pausing header sync from peer=%d, because we are too far ahead of block sync. (%d > %d)\n", pfrom.GetId(), pindexBestHeader->nHeight, m_chainman.ActiveHeight());
2031
+
if (nodestate->fSyncStarted) {
2032
+
// Cancel sync from this node, so we don't penalize it later.
2033
+
// This will cause us to automatically start syncing from a different node (or restart syncing from the same node) later,
boolfFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->IsAddrFetchConn()); // Download if this is a nice peer, or we have no nice peers and this one might do.
4479
-
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) {
0 commit comments