src/blockchain/watcher.js
/**
   * Finds all pending events, updates the # of confirmations.
   */
Finds all pending events, updates the # of confirmations.
Finds all pending events updates the # of confirmations .
async function updateEventConfirmations(currentBlock) {
    sem.take(async () => {
      try {
        const [err, eventsByConfirmations] = await to(
          getPendingEventsByConfirmations(currentBlock),
        );
        if (err) {
          logger.error('Error fetching pending events', err);
          sem.leave();
          return;
        }
        await Promise.all(
          eventsByConfirmations.map(async (e, confirmations) => {
            if (confirmations <= requiredConfirmations && e && e.length) {
              await eventService.patch(
                null,
                { confirmations },
                { query: { blockNumber: e[0].blockNumber } },
              );
            }
          }),
        );
      } catch (err) {
        logger.error('error calling updateConfirmations', err);
      }
      sem.leave();
    });
  }
async function updateEventConfirmations ( currentBlock ) { sem . take ( async ( ) => { try { const [ err , eventsByConfirmations ] = await to ( getPendingEventsByConfirmations ( currentBlock ) , ) ; if ( err ) { logger . error ( 'Error fetching pending events' , err ) ; sem . leave ( ) ; return ; } await Promise . all ( eventsByConfirmations . map ( async ( e , confirmations ) => { if ( confirmations <= requiredConfirmations && e && e . length ) { await eventService . patch ( null , { confirmations } , { query : { blockNumber : e [ 0 ] . blockNumber } } , ) ; } } ) , ) ; } catch ( err ) { logger . error ( 'error calling updateConfirmations' , err ) ; } sem . leave ( ) ; } ) ; }
Finds all pending events, updates the # of confirmations.
Finds all pending events updates the # of confirmations .
// updated the # of confirmations for the events