You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Extracts the _compound certificates_ from two lists of _base certificates_.
374
+
* This is required because **db-sync** stores _compound certificates_ splitting them in _base certificate records_.
375
+
*
376
+
* As an example:
377
+
*
378
+
* `stake_vote_deleg_cert` certificates are stored as a `stake_delegation` certificate record plus a `vote_deleg_cert`
379
+
* certificate record splitting `stake_vote_deleg_cert` properties: the `pool_keyhash` is stored in the first record
380
+
* and the `drep` is stored in the latter record.
381
+
*
382
+
* To make the lower amount of queries as possible, we perform one single query on each certificate table, next we use
383
+
* this function to merge them results.
384
+
*
385
+
* @param certs1 The first list _base certificates_.
386
+
* @param certs2 The second list of _base certificates_.
387
+
* @param merge The function to merge two _base certificates_ into a _compound certificate_.
388
+
* @returns The two lists of _base certificates_ (pruned by the ones used to create the _compound certificates_) and the list of _compound certificates_.
389
+
*/
372
390
constcompound=<
373
391
C1extendsCardano.HydratedCertificate,
374
392
C2extendsCardano.HydratedCertificate,
@@ -382,16 +400,21 @@ const compound = <
382
400
constresult: (readonly[number,C3])[]=[];
383
401
constfoundIndexes2: number[]=[];
384
402
403
+
// Iterate over certificates in the first list.
385
404
for(constc1ofcerts1){
405
+
// Check if in the second list there is a certificate with the same certificate index: i.e. they are two sources of the same _compound certificate_.
0 commit comments