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

@@ -122,6 +122,19 @@ impl<D: Db, S: ScannerFeed> ContinuallyRan for ScanTask<D, S> {
let keys = ScannerGlobalDb::<S>::active_keys_as_of_next_to_scan_for_outputs_block(&txn)
.expect("scanning for a blockchain without any keys set");
let latest_active_key = {
let mut keys = keys.clone();
loop {
// Use the most recent key
let key = keys.pop().unwrap();
// Unless this key is active, but not yet reporting
if key.stage == LifetimeStage::ActiveYetNotReporting {
continue;
}
break key.key;
}
};
// The scan data for this block
let mut scan_data = SenderScanData {
block_number: b,
@@ -157,7 +170,7 @@ impl<D: Db, S: ScannerFeed> ContinuallyRan for ScanTask<D, S> {
// Scan for each key
for key in &keys {
for output in block.scan_for_outputs(key.key) {
for output in block.scan_for_outputs(latest_active_key, key.key) {
assert_eq!(output.key(), key.key);
/*