Skip to content

Commit c0f88ed

Browse files
authored
make bulk size the same for testnet and mainnet (#8127)
1 parent 5abbefd commit c0f88ed

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

zebra-state/src/service/finalized_state.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -458,15 +458,11 @@ impl FinalizedState {
458458
let block_time = block.header.time.timestamp();
459459
let local_time = chrono::Utc::now().timestamp();
460460

461-
// Mainnet bulk size is small enough to avoid the elasticsearch 100mb content
462-
// length limitation. MAX_BLOCK_BYTES = 2MB but each block use around 4.1 MB of JSON.
461+
// Bulk size is small enough to avoid the elasticsearch 100mb content length limitation.
462+
// MAX_BLOCK_BYTES = 2MB but each block use around 4.1 MB of JSON.
463463
// Each block count as 2 as we send them with a operation/header line. A value of 48
464464
// is 24 blocks.
465-
const MAINNET_AWAY_FROM_TIP_BULK_SIZE: usize = 48;
466-
467-
// Testnet bulk size is larger as blocks are generally smaller in the testnet.
468-
// A value of 800 is 400 blocks as we are not counting the operation line.
469-
const TESTNET_AWAY_FROM_TIP_BULK_SIZE: usize = 800;
465+
const AWAY_FROM_TIP_BULK_SIZE: usize = 48;
470466

471467
// The number of blocks the bulk will have when we are in sync.
472468
// A value of 2 means only 1 block as we want to insert them as soon as we get
@@ -477,10 +473,7 @@ impl FinalizedState {
477473
// less than this number of seconds.
478474
const CLOSE_TO_TIP_SECONDS: i64 = 14400; // 4 hours
479475

480-
let mut blocks_size_to_dump = match self.network() {
481-
Network::Mainnet => MAINNET_AWAY_FROM_TIP_BULK_SIZE,
482-
Network::Testnet => TESTNET_AWAY_FROM_TIP_BULK_SIZE,
483-
};
476+
let mut blocks_size_to_dump = AWAY_FROM_TIP_BULK_SIZE;
484477

485478
// If we are close to the tip, index one block per bulk call.
486479
if local_time - block_time < CLOSE_TO_TIP_SECONDS {

0 commit comments

Comments
 (0)