forked from kaspanet/rusty-kaspa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Orphans improvements part 2 (kaspanet#373)
* track avg mergesets * unorphan ancestors if they exist w/o roots * refactor processing batch object + test fix * use warn * improve log * comment * orphan eviction policy * oops: use the correct len * review comments
- Loading branch information
1 parent
1905cee
commit 0c76768
Showing
9 changed files
with
196 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use kaspa_consensus_core::{api::BlockValidationFuture, block::Block}; | ||
use std::fmt::Debug; | ||
|
||
pub struct BlockProcessingBatch { | ||
pub blocks: Vec<Block>, | ||
pub block_tasks: Option<Vec<BlockValidationFuture>>, | ||
pub virtual_state_tasks: Option<Vec<BlockValidationFuture>>, | ||
} | ||
|
||
impl BlockProcessingBatch { | ||
pub fn new(blocks: Vec<Block>, block_tasks: Vec<BlockValidationFuture>, virtual_state_tasks: Vec<BlockValidationFuture>) -> Self { | ||
Self { blocks, block_tasks: Some(block_tasks), virtual_state_tasks: Some(virtual_state_tasks) } | ||
} | ||
|
||
pub fn zip(self) -> impl Iterator<Item = (Block, BlockValidationFuture)> { | ||
self.blocks.into_iter().zip(self.virtual_state_tasks.unwrap()) | ||
} | ||
} | ||
|
||
impl Default for BlockProcessingBatch { | ||
fn default() -> Self { | ||
Self { blocks: Default::default(), block_tasks: Some(Default::default()), virtual_state_tasks: Some(Default::default()) } | ||
} | ||
} | ||
|
||
impl Debug for BlockProcessingBatch { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.debug_struct("BlockProcessingBatch").field("blocks", &self.blocks).finish() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.