Skip to content

Commit

Permalink
fix: handle missingPools in remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
filo87 committed Feb 24, 2025
1 parent f66d4d2 commit dfbbdb2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mappings/handlers/remarkHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { SubstrateEvent } from '@subql/types'
import { errorHandler } from '../../helpers/errorHandler'
import { errorHandler, missingPool } from '../../helpers/errorHandler'
import { RemarkEvent } from '../../helpers/types'
import { AttestationService } from '../services/attestationService'
import { AccountService } from '../services/accountService'
import { PoolService } from '../services/poolService'

export const handleRemark = errorHandler(_handleRemark)
async function _handleRemark(event: SubstrateEvent<RemarkEvent>) {
Expand All @@ -11,10 +12,11 @@ async function _handleRemark(event: SubstrateEvent<RemarkEvent>) {
const account = await AccountService.getOrInit(event.extrinsic.extrinsic.signer.toHex())
logger.info(`Remark event fired for ${event.hash.toString()} at block ${event.block.block.header.number.toNumber()}`)
const namedRemarks = remarks.filter((remark) => remark.isNamed)

for (const namedRemark of namedRemarks) {
const namedRemarkData = namedRemark.asNamed.toUtf8()
const [type, poolId, attestationData] = namedRemarkData.split(':')
const pool = await PoolService.get(poolId)
if (!pool) throw missingPool
logger.info(`Named remark with data: ${namedRemarkData}`)
if (type === 'attestation') {
const attestation = await AttestationService.init(
Expand Down

0 comments on commit dfbbdb2

Please sign in to comment.