Pass the latest active key to the Block's scan function

Effectively necessary for networks on which we utilize account abstraction in
order to know what key to associate the received coins with.
This commit is contained in:
Luke Parker
2024-09-19 01:00:31 -04:00
parent 118d81bc90
commit 673cf8fd47
9 changed files with 60 additions and 10 deletions

View File

@@ -273,6 +273,18 @@ impl<D: Db, S: ScannerFeed, Sch: Scheduler<S>> ContinuallyRan for EventualityTas
log::debug!("checking eventuality completions in block: {} ({b})", hex::encode(block.id()));
let (keys, keys_with_stages) = self.keys_and_keys_with_stages(b);
let latest_active_key = {
let mut keys_with_stages = keys_with_stages.clone();
loop {
// Use the most recent key
let (key, stage) = keys_with_stages.pop().unwrap();
// Unless this key is active, but not yet reporting
if stage == LifetimeStage::ActiveYetNotReporting {
continue;
}
break key;
}
};
let mut txn = self.db.txn();
@@ -307,7 +319,7 @@ impl<D: Db, S: ScannerFeed, Sch: Scheduler<S>> ContinuallyRan for EventualityTas
}
// Fetch all non-External outputs
let mut non_external_outputs = block.scan_for_outputs(key.key);
let mut non_external_outputs = block.scan_for_outputs(latest_active_key, key.key);
non_external_outputs.retain(|output| output.kind() != OutputType::External);
// Drop any outputs less than the dust limit
non_external_outputs.retain(|output| {