diff --git a/watcher/src/watchers/SolanaWatcher.ts b/watcher/src/watchers/SolanaWatcher.ts index 186be0b7..0dacc8d0 100644 --- a/watcher/src/watchers/SolanaWatcher.ts +++ b/watcher/src/watchers/SolanaWatcher.ts @@ -206,6 +206,12 @@ export class SolanaWatcher extends Watcher { .concat(instructions) .filter((i) => i.programIdIndex === programIdIndex); + const blockKey = makeBlockKey( + res.slot.toString(), + new Date(res.blockTime * 1000).toISOString() + ); + + const vaaKeys: string[] = []; for (const instruction of whInstructions) { // skip if not postMessage instruction const instructionId = instruction.data; @@ -216,20 +222,17 @@ export class SolanaWatcher extends Watcher { message: { emitterAddress, sequence }, } = await getPostedMessage(this.getConnection(), accountId.toBase58(), COMMITMENT); - const blockKey = makeBlockKey( - res.slot.toString(), - new Date(res.blockTime * 1000).toISOString() - ); - - const vaaKey = makeVaaKey( - res.transaction.signatures[0], - this.chain, - emitterAddress.toString('hex'), - sequence.toString() + vaaKeys.push( + makeVaaKey( + res.transaction.signatures[0], + this.chain, + emitterAddress.toString('hex'), + sequence.toString() + ) ); - - vaasByBlock[blockKey] = [...(vaasByBlock[blockKey] || []), vaaKey]; } + if (vaaKeys.length > 0) + vaasByBlock[blockKey] = [...vaaKeys, ...(vaasByBlock[blockKey] || [])]; } numSignatures = signatures.length;