From 2ce0177b59a80066732da51d120e1d443f5ba647 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 22 Dec 2025 23:56:53 -0800 Subject: [PATCH] =?UTF-8?q?fix(blockchain-service):=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E7=83=AD=E9=92=B1=E5=8C=85=E5=8F=91=E5=87=BA=E7=9A=84=E8=BD=AC?= =?UTF-8?q?=E8=B4=A6=E9=81=BF=E5=85=8D=E5=86=85=E9=83=A8=E8=BD=AC=E8=B4=A6?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=85=A5=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 内部转账时,wallet-service 已经处理了接收方入账, 需要过滤掉 blockchain-service 扫描到的热钱包转出交易, 避免将其当作充值重复处理导致双倍入账 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../application/services/deposit-detection.service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/services/blockchain-service/src/application/services/deposit-detection.service.ts b/backend/services/blockchain-service/src/application/services/deposit-detection.service.ts index 7fa7b05f..4a14e127 100644 --- a/backend/services/blockchain-service/src/application/services/deposit-detection.service.ts +++ b/backend/services/blockchain-service/src/application/services/deposit-detection.service.ts @@ -9,6 +9,7 @@ import { EventPublisherService } from '@/infrastructure/kafka/event-publisher.se import { AddressCacheService } from '@/infrastructure/redis/address-cache.service'; import { ConfirmationPolicyService } from '@/domain/services/confirmation-policy.service'; import { ChainConfigService } from '@/domain/services/chain-config.service'; +import { Erc20TransferService } from '@/domain/services/erc20-transfer.service'; import { DEPOSIT_TRANSACTION_REPOSITORY, IDepositTransactionRepository, @@ -44,6 +45,7 @@ export class DepositDetectionService implements OnModuleInit { private readonly addressCache: AddressCacheService, private readonly confirmationPolicy: ConfirmationPolicyService, private readonly chainConfig: ChainConfigService, + private readonly transferService: Erc20TransferService, @Inject(DEPOSIT_TRANSACTION_REPOSITORY) private readonly depositRepo: IDepositTransactionRepository, @Inject(MONITORED_ADDRESS_REPOSITORY) @@ -141,6 +143,13 @@ export class DepositDetectionService implements OnModuleInit { const chainType = ChainType.fromEnum(event.chainType); + // 过滤从热钱包发出的转账(内部转账/提现),避免重复入账 + const hotWalletAddress = this.transferService.getHotWalletAddress(event.chainType); + if (hotWalletAddress && event.from.toLowerCase() === hotWalletAddress.toLowerCase()) { + this.logger.debug(`Skipping hot wallet outgoing transfer: ${event.txHash} from ${event.from}`); + return; + } + // 查找监控地址以获取用户ID或系统账户信息 const monitoredAddress = await this.monitoredAddressRepo.findByChainAndAddress( chainType,