commit 315460ba2277c8d78b0904d2ba6ba4f65ef8f240
parent e3a8a18285204bacd8a336f60edd637111292052
Author: Sebastian <sebasjm@taler-systems.com>
Date: Wed, 22 Jul 2026 15:19:28 -0300
prepopulate polHashToIndex with oldAgg to avoid missing info
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/packages/anastasis-core/src/index.ts b/packages/anastasis-core/src/index.ts
@@ -1678,7 +1678,13 @@ export function mergeDiscoveryAggregate(
oldAgg: AggregatedPolicyMetaInfo[],
): AggregatedPolicyMetaInfo[] {
const aggregatedPolicies: AggregatedPolicyMetaInfo[] = [...oldAgg];
- const polHashToIndex: Record<string, number> = {};
+ const polHashToIndex: Record<string, number> = oldAgg.reduce(
+ (prev, cur, indx) => {
+ prev[cur.policy_hash] = indx;
+ return prev;
+ },
+ {} as Record<string, number>,
+ );
for (const pol of newPolicies) {
const oldIndex = polHashToIndex[pol.policy_hash];
if (oldIndex != null) {