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,