From 812cbd03b85bed49db58ccad7d0001b21c65e32b Mon Sep 17 00:00:00 2001 From: martbost Date: Fri, 18 Sep 2026 09:55:51 -0500 Subject: [PATCH] Log every Telegram send with a per-process id while tracing duplicate payment lines Members are seeing payment receipts twice. This process has a durable announce-once per on-chain event and a send-level dedupe, and neither is firing, which says the second copy is not originating here. Rather than keep reasoning about it, log every send with a random per-process id so the log answers it directly: two ids means a second instance is posting, one id twice means the dedupe key differs. Temporary. Comes out once the source is confirmed. Co-Authored-By: Claude Opus 5 (1M context) --- server.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server.js b/server.js index 45be1fe..410e015 100644 --- a/server.js +++ b/server.js @@ -174,6 +174,8 @@ function sendTelegram(text, topicId, replyMarkup) { // to the same chat twice within the window. Distinct events never collide — every line // carries its own ids, amount and transaction hash. const TG_RECENT = new Map(); +// random per-process id: if two instances are posting, their sends carry different ids +const TG_INSTANCE = Math.random().toString(36).slice(2, 8); const TG_DEDUPE_MS = 15 * 60 * 1000; function tgSeenRecently(chatId, topicId, text) { const k = String(chatId) + '|' + String(topicId || '') + '|' + text; @@ -191,6 +193,13 @@ function sendTelegramTo(chatId, text, topicId, replyMarkup, parseMode) { console.warn('telegram duplicate suppressed:', String(text).replace(/\s+/g, ' ').slice(0, 90)); return; } + // TEMPORARY (2026-09-18): members are seeing payment lines twice. This process has a + // durable announce-once per on-chain event AND a send-level dedupe, and neither is firing, + // which means the second copy is not coming from here. Log every send with the instance id + // so "did WE send it twice, or is something else posting?" is answerable from the log + // instead of by deduction. Remove once the source is confirmed. + console.log('tg-send', TG_INSTANCE, 'chat=' + chatId, 'topic=' + (topicId || '-'), + JSON.stringify(String(text).replace(/\s+/g, ' ').slice(0, 70))); // No link previews: payout/team-build posts carry Polygonscan links, and the // preview card tripled the height of every message in the group. const payload = { chat_id: chatId, text, disable_web_page_preview: true };