mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-20 23:19:49 +00:00
add docs and unit tests
This commit is contained in:
parent
95a58faf94
commit
22290c05fb
@ -253,6 +253,7 @@ impl SequencerCore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the list of stored pending blocks.
|
||||||
pub fn get_pending_blocks(&self) -> Result<Vec<Block>> {
|
pub fn get_pending_blocks(&self) -> Result<Vec<Block>> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.store
|
.store
|
||||||
@ -813,7 +814,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_delete_blocks() {
|
fn test_get_pending_blocks() {
|
||||||
let config = setup_sequencer_config();
|
let config = setup_sequencer_config();
|
||||||
let (mut sequencer, _mempool_handle) = SequencerCore::start_from_config(config);
|
let (mut sequencer, _mempool_handle) = SequencerCore::start_from_config(config);
|
||||||
sequencer
|
sequencer
|
||||||
@ -826,11 +827,27 @@ mod tests {
|
|||||||
.produce_new_block_with_mempool_transactions()
|
.produce_new_block_with_mempool_transactions()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(sequencer.get_pending_blocks().unwrap().len(), 4);
|
assert_eq!(sequencer.get_pending_blocks().unwrap().len(), 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_delete_blocks() {
|
||||||
|
let config = setup_sequencer_config();
|
||||||
|
let (mut sequencer, _mempool_handle) = SequencerCore::start_from_config(config);
|
||||||
|
sequencer
|
||||||
|
.produce_new_block_with_mempool_transactions()
|
||||||
|
.unwrap();
|
||||||
|
sequencer
|
||||||
|
.produce_new_block_with_mempool_transactions()
|
||||||
|
.unwrap();
|
||||||
|
sequencer
|
||||||
|
.produce_new_block_with_mempool_transactions()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let last_finalized_block = 3;
|
let last_finalized_block = 3;
|
||||||
sequencer
|
sequencer
|
||||||
.delete_finalized_blocks_from_db(last_finalized_block)
|
.delete_finalized_blocks_from_db(last_finalized_block)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(sequencer.get_pending_blocks().unwrap().len(), 1);
|
assert_eq!(sequencer.get_pending_blocks().unwrap().len(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user