Remove bound that WINDOW_LENGTH < CONFIRMATIONS

It's unnecessary and not valuable.
This commit is contained in:
Luke Parker 2024-09-10 06:40:41 -04:00
parent 2d4b775b6e
commit e36b671f37
3 changed files with 5 additions and 6 deletions

View file

@ -120,7 +120,7 @@ impl<S: ScannerFeed> ScannerGlobalDb<S> {
/// A new key MUST NOT be queued to activate a block preceding the finishing of the key prior to /// A new key MUST NOT be queued to activate a block preceding the finishing of the key prior to
/// its prior. There MUST only be two keys active at one time. /// its prior. There MUST only be two keys active at one time.
/// ///
/// activation_block_number is inclusive, so the key will be scanned for starting at the /// `activation_block_number` is inclusive, so the key will be scanned for starting at the
/// specified block. /// specified block.
pub(crate) fn queue_key(txn: &mut impl DbTxn, activation_block_number: u64, key: KeyFor<S>) { pub(crate) fn queue_key(txn: &mut impl DbTxn, activation_block_number: u64, key: KeyFor<S>) {
// Set the block which has a key activate as notable // Set the block which has a key activate as notable

View file

@ -123,8 +123,8 @@ impl<D: Db, S: ScannerFeed, Sch: Scheduler<S>> EventualityTask<D, S, Sch> {
block_number: u64, block_number: u64,
) -> (Vec<SeraiKey<KeyFor<S>>>, Vec<(KeyFor<S>, LifetimeStage)>) { ) -> (Vec<SeraiKey<KeyFor<S>>>, Vec<(KeyFor<S>, LifetimeStage)>) {
/* /*
This is proper as the keys for the next-to-scan block (at most `WINDOW_LENGTH` ahead, This is proper as the keys for the next-to-scan block (at most `WINDOW_LENGTH` ahead) will be
which is `<= CONFIRMATIONS`) will be the keys to use here, with only minor edge cases. the keys to use here, with only minor edge cases.
This may include a key which has yet to activate by our perception. We can simply drop This may include a key which has yet to activate by our perception. We can simply drop
those. those.
@ -136,7 +136,6 @@ impl<D: Db, S: ScannerFeed, Sch: Scheduler<S>> EventualityTask<D, S, Sch> {
This also may include a key we've retired which has yet to officially retire. That's fine as This also may include a key we've retired which has yet to officially retire. That's fine as
we'll do nothing with it, and the Scheduler traits document this behavior. we'll do nothing with it, and the Scheduler traits document this behavior.
*/ */
assert!(S::WINDOW_LENGTH <= S::CONFIRMATIONS);
let mut keys = ScannerGlobalDb::<S>::active_keys_as_of_next_to_scan_for_outputs_block(&self.db) let mut keys = ScannerGlobalDb::<S>::active_keys_as_of_next_to_scan_for_outputs_block(&self.db)
.expect("scanning for a blockchain without any keys set"); .expect("scanning for a blockchain without any keys set");
// Since the next-to-scan block is ahead of us, drop keys which have yet to actually activate // Since the next-to-scan block is ahead of us, drop keys which have yet to actually activate

View file

@ -71,8 +71,8 @@ pub trait ScannerFeed: 'static + Send + Sync + Clone {
/// The amount of blocks to process in parallel. /// The amount of blocks to process in parallel.
/// ///
/// This must be at least `1`. This must be less than or equal to `CONFIRMATIONS`. This value /// This must be at least `1`. This value should be the worst-case latency to handle a block
/// should be the worst-case latency to handle a block divided by the expected block time. /// divided by the expected block time.
const WINDOW_LENGTH: u64; const WINDOW_LENGTH: u64;
/// The amount of blocks which will occur in 10 minutes (approximate). /// The amount of blocks which will occur in 10 minutes (approximate).