fix(blockchain): fix deposit stuck in CONFIRMING status

The updateConfirmations logic only checked for DETECTED status
when confirming, so deposits that transitioned to CONFIRMING
would never be confirmed even with enough confirmations.

Changed condition to accept both DETECTED and CONFIRMING status.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-10 12:19:29 -08:00
parent 5e670e64b3
commit db3e0ba1bd
1 changed files with 3 additions and 1 deletions

View File

@ -161,12 +161,14 @@ export class DepositTransaction extends AggregateRoot<bigint> {
const confirmations = Number(currentBlockNumber.diff(this.props.blockNumber));
this.props.confirmations = Math.max(0, confirmations);
// 检查是否达到确认要求(状态为 DETECTED 或 CONFIRMING 都可以确认)
if (
this.props.confirmations >= requiredConfirmations &&
this.props.status === DepositStatus.DETECTED
(this.props.status === DepositStatus.DETECTED || this.props.status === DepositStatus.CONFIRMING)
) {
this.confirm();
} else if (this.props.status === DepositStatus.DETECTED) {
// 首次检测但确认数不够,标记为确认中
this.props.status = DepositStatus.CONFIRMING;
}
}