Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/chain/store/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ impl<DB: Blockstore> ChainIndex<DB> {
let ts_height_cache: SizeTrackingLruCache<ChainEpoch, TipsetKey> =
SizeTrackingLruCache::new_with_metrics(
"tipset_by_height".into(),
// 20480 * 900 = 18432000 which is sufficient for mainnet
nonzero!(20480_usize),
// 1048576 * 20 = 20971520 which is sufficient for mainnet
Comment thread
hanabi1224 marked this conversation as resolved.
// Maximum ~32MiB RAM usage
nonzero!(1048576_usize),
Comment thread
hanabi1224 marked this conversation as resolved.
);
Self {
ts_cache,
Expand Down Expand Up @@ -152,8 +153,9 @@ impl<DB: Blockstore> ChainIndex<DB> {
) -> Result<Tipset, Error> {
use crate::shim::policy::policy_constants::CHAIN_FINALITY;

// use `CHAIN_FINALITY` as checkpoint interval
const CHECKPOINT_INTERVAL: ChainEpoch = CHAIN_FINALITY;
// use `20` as checkpoint interval to match Lotus:
// <https://github.com/filecoin-project/lotus/blob/v1.35.1/chain/store/index.go#L52>
const CHECKPOINT_INTERVAL: ChainEpoch = 20;
fn next_checkpoint(epoch: ChainEpoch) -> ChainEpoch {
epoch - epoch.mod_floor(&CHECKPOINT_INTERVAL) + CHECKPOINT_INTERVAL
}
Expand Down
Loading