From e4207c9896c54f078d1eb4ba4c96d3144c1750b6 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Mon, 30 Sep 2024 15:26:37 +0200 Subject: [PATCH] WIP --- src/pre_derived_keys_cache/cache_outcome.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pre_derived_keys_cache/cache_outcome.rs b/src/pre_derived_keys_cache/cache_outcome.rs index 7517e26b..2db8c826 100644 --- a/src/pre_derived_keys_cache/cache_outcome.rs +++ b/src/pre_derived_keys_cache/cache_outcome.rs @@ -59,6 +59,7 @@ pub struct LoadFromCacheOutcomeForSingleRequest { pub request: QuantifiedUnindexDerivationRequest, outcome: LoadFromCacheOutcome, } + impl LoadFromCacheOutcomeForSingleRequest { /// # Panics /// If FactorInstances is NOT empty inside the outcome, this ctor @@ -84,12 +85,14 @@ impl LoadFromCacheOutcomeForSingleRequest { outcome, } } + fn last_index_of(instances: &FactorInstances) -> HDPathValue { assert!(!instances.is_empty()); let mut instances = instances.factor_instances().into_iter().collect_vec(); instances.sort_by_key(|instance| instance.derivation_entity_base_index()); instances.last().unwrap().derivation_entity_base_index() } + pub fn action(&self) -> Action { match self.outcome { LoadFromCacheOutcome::FullySatisfiedWithSpare(ref from_cache) => { @@ -143,6 +146,7 @@ pub struct FactorInstancesFromCache { hidden: HiddenConstructor, outcomes: Vec, } + impl FactorInstancesFromCache { pub fn new(iter: impl IntoIterator) -> Self { Self { @@ -154,6 +158,7 @@ impl FactorInstancesFromCache { .collect(), } } + pub fn outcomes(&self) -> IndexSet { self.outcomes.clone().into_iter().collect() }