From 331fdc5553f4bc7adb17e9d56a13964b05292efa Mon Sep 17 00:00:00 2001 From: offerm Date: Wed, 14 Sep 2022 23:01:36 +0300 Subject: [PATCH 1/2] slot_has_updates should not check if slot is full (and connected) This allows the replay loop to process shreds earlier. The replay loop does not need to wait 100ms between processing of shreds and can process them as soon as these are available. Expected speed up to replay loop 100-200 ms No risk --- ledger/src/blockstore.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 78b87ee257bc92..7311cf2a79c094 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -3822,14 +3822,13 @@ fn slot_has_updates(slot_meta: &SlotMeta, slot_meta_backup: &Option) - // from block 0, which is true iff: // 1) The block with index prev_block_index is itself part of the trunk of consecutive blocks // starting from block 0, - slot_meta.is_connected && // AND either: // 1) The slot didn't exist in the database before, and now we have a consecutive // block for that slot - ((slot_meta_backup.is_none() && slot_meta.consumed != 0) || + (slot_meta_backup.is_none() && slot_meta.consumed != 0) || // OR // 2) The slot did exist, but now we have a new consecutive block for that slot - (slot_meta_backup.is_some() && slot_meta_backup.as_ref().unwrap().consumed != slot_meta.consumed)) + (slot_meta_backup.is_some() && slot_meta_backup.as_ref().unwrap().consumed != slot_meta.consumed) } // Creates a new ledger with slot 0 full of ticks (and only ticks). From 0d7ca1c8791de9638969e7daa89f77ffa4e570ad Mon Sep 17 00:00:00 2001 From: offerm Date: Thu, 15 Sep 2022 10:31:27 +0300 Subject: [PATCH 2/2] fix fmt --- ledger/src/blockstore.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 7311cf2a79c094..af68e937b932fb 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -3822,10 +3822,10 @@ fn slot_has_updates(slot_meta: &SlotMeta, slot_meta_backup: &Option) - // from block 0, which is true iff: // 1) The block with index prev_block_index is itself part of the trunk of consecutive blocks // starting from block 0, - // AND either: - // 1) The slot didn't exist in the database before, and now we have a consecutive - // block for that slot - (slot_meta_backup.is_none() && slot_meta.consumed != 0) || + // AND either: + // 1) The slot didn't exist in the database before, and now we have a consecutive + // block for that slot + (slot_meta_backup.is_none() && slot_meta.consumed != 0) || // OR // 2) The slot did exist, but now we have a new consecutive block for that slot (slot_meta_backup.is_some() && slot_meta_backup.as_ref().unwrap().consumed != slot_meta.consumed)