问题描述:
withdrawal-status.handler.ts 的 executeWithdrawalFailed() 方法在处理
提现失败事件时,虽然正确地将冻结余额退回到可用余额(usdt_frozen → usdt_available),
但没有在 wallet_ledger_entries 表中写入 UNFREEZE 类型的流水记录,导致审计缺口。
对比 system-withdrawal-application.service.ts 中的同名方法 handleWithdrawalFailed(),
后者在退回余额时正确地写入了 UNFREEZE ledger entry。两者逻辑应保持一致。
影响范围:
所有通过 blockchain-service Kafka 事件触发的提现失败场景(包括链上提现和内部转账),
余额变动不会被记录到流水表中,无法审计追踪。
修复内容:
在 wallet_accounts 余额更新成功后,新增 tx.ledgerEntry.create() 调用,
写入 UNFREEZE 类型的流水记录,包含:
- amount: 实际退回金额(newAvailable - currentAvailable,兼容冻结不足的边缘情况)
- memo: "提现失败退款: {error}"
- payloadJson: toAddress, chainType, error 便于排查
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| docs | ||
| prisma | ||
| scripts | ||
| src | ||
| test | ||
| .env.example | ||
| .gitignore | ||
| Dockerfile | ||
| deploy.sh | ||
| nest-cli.json | ||
| package.json | ||
| tsconfig.build.json | ||
| tsconfig.json | ||