fixup! feat(engine): create engine rust package for detectors and orchestration

Seed TxGraph ownership state from all derived addresses, not just addresses discovered from transaction outputs. This makes is_ours() recognize every descriptor-derived address and preserves internal/change tagging separately.
This commit is contained in:
Renato Britto
2026-03-31 19:31:48 -03:00
parent 14ac5c80a1
commit ea6c90bf41
2 changed files with 13 additions and 0 deletions

View File

@@ -171,6 +171,7 @@ impl<'a, G: BlockchainGateway> AnalysisEngine<'a, G> {
utxos: utxo_entries,
transactions,
internal_addresses: HashSet::new(),
derived_addresses: HashSet::new(),
})
}
}

View File

@@ -140,6 +140,18 @@ impl TxGraph {
})
.collect();
// Add ALL derived addresses to `our_addrs` and `addr_map`, matching
// the Python reference (`our_addrs = set(addr_map.keys())` where
// `addr_map` contains every address derived from the descriptors).
for addr in &history.derived_addresses {
our_addrs.insert(addr.clone());
addr_map.entry(addr.clone()).or_insert_with(|| AddressInfo {
script_type: script_type_from_address(addr),
internal: history.internal_addresses.contains(addr),
index: 0,
});
}
// Pre-populate caches from decoded transactions.
let mut tx_cache = HashMap::new();
let mut input_cache: HashMap<Txid, Vec<InputInfo>> = HashMap::new();