로그 개수 줄임 및 트랜잭션 시간 체크 제거

This commit is contained in:
Beomhee.Lee 2025-12-16 17:09:10 +09:00
parent 9b16d4a879
commit a6517152b5

View File

@ -187,7 +187,7 @@ func getAlchemyTokenTransfers(address string, contractAddress string, fromBlock
}
// HTTP POST 요청
umlog.Debug("Request - Address: %s, From: %s, To: %s", address, fromBlock, toBlock)
// umlog.Debug("Request - Address: %s, From: %s, To: %s", address, fromBlock, toBlock)
// umlog.Debug("[getAlchemyTokenTransfers] Padded address (topic[2]): %s\n", paddedAddress)
// umlog.Debug("[getAlchemyTokenTransfers] Request body: %s", string(requestBody))
req, err := http.NewRequest("POST", CODE_STRC.ALCHEMY_MAINNET, bytes.NewBuffer(requestBody))
@ -444,7 +444,7 @@ func checkWalletWithAlchemy(walletDBConn *sql.DB, header model.Header, userId in
fromBlockHex := fmt.Sprintf("0x%x", startBlock)
toBlockHex := fmt.Sprintf("0x%x", currentBlock)
umlog.Debug("Checking blocks %d to %d (range: %d)\n", startBlock, currentBlock, blocksToCheck)
// umlog.Debug("Checking blocks %d to %d (range: %d)\n", startBlock, currentBlock, blocksToCheck)
// Alchemy API로 Transfer 이벤트 조회
transfers, err := getAlchemyTokenTransfers(walletAddress, contractAddress, fromBlockHex, toBlockHex, CODE_STRC)
@ -459,12 +459,12 @@ func checkWalletWithAlchemy(walletDBConn *sql.DB, header model.Header, userId in
umlog.Debug("transfer info: %v\n", transfer)
// 트랜잭션 시각 체크 (Timestamp 사용)
txTime := time.Unix(transfer.Timestamp, 0)
// txTime := time.Unix(transfer.Timestamp, 0)
// 마지막 체크 이후의 트랜잭션만 처리
if txTime.Before(lastCheckTime) {
continue
}
// if txTime.Before(lastCheckTime) {
// continue
// }
// 이미 알림 보낸 트랜잭션인지 확인
if isTransactionNotified(walletDBConn, transfer.TransactionHash) {
@ -482,8 +482,8 @@ func checkWalletWithAlchemy(walletDBConn *sql.DB, header model.Header, userId in
newTransactionCount++
umlog.Info("checkWalletWithAlchemy\nNew incoming tx detected - User: %d, From: %s, Amount: %s CYBX, Hash: %s",
userId, transfer.From, amount, transfer.TransactionHash)
// umlog.Info("checkWalletWithAlchemy\nNew incoming tx detected - User: %d, From: %s, Amount: %s CYBX, Hash: %s",
// userId, transfer.From, amount, transfer.TransactionHash)
}
return newTransactionCount, nil
@ -682,8 +682,8 @@ func sendIncomingTransactionNotification(walletDBConn *sql.DB, header model.Head
// Telegram 알림 (관리자용)
messageboxy := fmt.Sprintf(
"💰 Deposit notification(from Alchemy)\nFrom: %s\nTo: %s\nAmount: %s CYBX\nTxHash: %s",
fromAddress, toAddress, amount, txHash)
"💰 Deposit notification(from Alchemy)\nFrom: %s\nAmount: %s CYBX\nTxHash: %s\n",
fromAddress, amount, txHash)
message := map[string]string{"message": messageboxy}
jsonData, err := json.Marshal(message)
if err != nil {