|
@@ -232,7 +232,12 @@ export class MonitorService {
|
|
|
if (logs.err) return
|
|
if (logs.err) return
|
|
|
|
|
|
|
|
const sig = logs.signature
|
|
const sig = logs.signature
|
|
|
- if (!this.markSeen(sig)) return // Already seen within TTL window
|
|
|
|
|
|
|
+ if (!this.markSeen(sig)) {
|
|
|
|
|
+ console.log(`[Monitor] WS dedup skip: ${sig.slice(0, 12)}...`)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ console.log(`[Monitor] WS received: ${sig.slice(0, 12)}...`)
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
await this.processTransaction(sig)
|
|
await this.processTransaction(sig)
|
|
@@ -286,12 +291,18 @@ export class MonitorService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private async processTransaction(signature: string) {
|
|
private async processTransaction(signature: string) {
|
|
|
|
|
+ const shortSig = `${signature.slice(0, 12)}...`
|
|
|
|
|
+
|
|
|
// Skip if already processing (in-flight lock)
|
|
// Skip if already processing (in-flight lock)
|
|
|
- if (this.processingSigs.has(signature)) return
|
|
|
|
|
|
|
+ if (this.processingSigs.has(signature)) {
|
|
|
|
|
+ console.log(`[Monitor] Skip ${shortSig}: already processing`)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
this.processingSigs.add(signature)
|
|
this.processingSigs.add(signature)
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
if (isTxProcessed(signature)) {
|
|
if (isTxProcessed(signature)) {
|
|
|
|
|
+ console.log(`[Monitor] Skip ${shortSig}: already in DB`)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -301,10 +312,25 @@ export class MonitorService {
|
|
|
maxSupportedTransactionVersion: 0,
|
|
maxSupportedTransactionVersion: 0,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- if (!tx) return
|
|
|
|
|
|
|
+ if (!tx) {
|
|
|
|
|
+ console.log(`[Monitor] Skip ${shortSig}: getParsedTransaction returned null`)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
const parsed = parseTransaction(tx, this.watchedAddresses)
|
|
const parsed = parseTransaction(tx, this.watchedAddresses)
|
|
|
- if (!parsed) return
|
|
|
|
|
|
|
+ if (!parsed) {
|
|
|
|
|
+ // Debug: check if any watched address is in this tx
|
|
|
|
|
+ const txAddrs = tx.transaction.message.accountKeys.map((k) =>
|
|
|
|
|
+ typeof k === 'string' ? k : 'pubkey' in k ? k.pubkey.toBase58() : '',
|
|
|
|
|
+ )
|
|
|
|
|
+ const matchedAddr = txAddrs.find((a) => this.watchedAddresses.has(a))
|
|
|
|
|
+ if (matchedAddr) {
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ `[Monitor] Skip ${shortSig}: parseTransaction returned null but watched address ${matchedAddr.slice(0, 12)}... IS in tx accounts`,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
console.log(`[Monitor] Detected ${parsed.type} from ${parsed.signer} (tx: ${signature})`)
|
|
console.log(`[Monitor] Detected ${parsed.type} from ${parsed.signer} (tx: ${signature})`)
|
|
|
|
|
|