// Copyright 2024 XDC Network
// XDC sync speed optimization knobs

package core

// Tunable constants for XDC sync optimisation.
const (
	// XdcBulkTriesInMemory is the effective TriesInMemory during bulk sync.
	// Keeping more tries in RAM avoids expensive trie GC flushes while we are
	// still catching up with the network. Increased from 1024 to 4096 to
	// reduce trie commit frequency by 4x during fast-sync.
	XdcBulkTriesInMemory = 4096

	// XdcChainHeadEventInterval controls how often the chainHeadEvent is fired
	// during bulk sync (every N canonical blocks). Firing it for every block is
	// wasteful because nobody is watching during initial sync.
	XdcChainHeadEventInterval = 512 // v91: 512 (was 256) — even less overhead during sync

	// XdcCheckpointInterval is the epoch length for XDC chains.
	// Every 900th block is a checkpoint where full execution is required.
	XdcCheckpointInterval = 900

	// XdcMaxPeersDuringSSync is the effective MaxPeers during bulk sync.
	// More peers = more parallel body delivery = higher throughput.
	XdcMaxPeersDuringSync = 200

	// XdcBodyMinBatch is the minimum body batch size per peer request.
	// Prevents tiny batches that waste round-trips.
	XdcBodyMinBatch = 256 // v91: larger minimum batch — XDC blocks are tiny, reduces round-trips
)
