File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -460,7 +460,7 @@ export async function connectTransactionsListToPrices (
460460  } 
461461
462462  // ---- efficient fetch ---- 
463-   const  timestampToPrice :  Record < number ,  AllPrices >   =   { } 
463+   const  priceByNetworkTs   =   new   Map < string ,  AllPrices > ( ) 
464464  let  pairs  =  0 
465465
466466  for  ( const  [ networkId ,  timestamps ]  of  networkIdToTimestamps . entries ( ) )  { 
@@ -502,7 +502,7 @@ export async function connectTransactionsListToPrices (
502502        ) 
503503      } 
504504
505-       timestampToPrice [ ts ]   =   allPrices  as  AllPrices 
505+       priceByNetworkTs . set ( ` ${ networkId } : ${ ts } ` ,   allPrices  as  AllPrices ) 
506506    } 
507507  } 
508508
@@ -512,7 +512,10 @@ export async function connectTransactionsListToPrices (
512512  const  rows : Prisma . PricesOnTransactionsCreateManyInput [ ]  =  [ ] 
513513  for  ( const  t  of  txList )  { 
514514    const  ts  =  flattenTimestamp ( t . timestamp ) 
515-     const  allPrices  =  timestampToPrice [ ts ] 
515+     const  allPrices  =  priceByNetworkTs . get ( `${ t . address . networkId } ${ ts }  ) 
516+     if  ( allPrices  ==  null )  { 
517+       throw  new  Error ( `[PRICES] Missing price pair for networkId ${ t . address . networkId } ${ moment . unix ( ts ) . format ( HUMAN_READABLE_DATE_FORMAT ) }  ) 
518+     } 
516519    rows . push ( ...buildPriceTxConnectionInput ( t ,  allPrices ) ) 
517520  } 
518521  console . log ( `[PRICES] Built ${ rows . length }  ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments