Skip to main content

Polygon Null blockNumber Guard

Version: 1.0.0 Date: 2026-07-15

Goal: Prevent Polygon transactions still pending on-chain from being marked as confirmed in the database — proof records appeared valid while the transaction was never mined.

Solution: Add an explicit tx.blockNumber null check in PolygonService#verifyTransaction before calling getBlock().

Root cause:

  • getBlock(null) returned the latest block
  • latestBlock - null + 1 coerced null to 0 in JavaScript
  • Confirmations count exceeded minConfirmations incorrectly

Features:

  • Pending TX stay in verification loop until mined or dropped
  • Complements TransactionDroppedError path for mempool drops

Files Modified:

  • src/services/polygon/polygon.service.ts - blockNumber guard before confirmation arithmetic

Related: Consolidated with Polygon RBF & monitoring in the same release train.

Release fragment: fix-polygon-null-blockNumber