Go to file
hailin 41e7eed2c1 fix(android): 修复 markPartyReady 重试逻辑的循环退出Bug [CRITICAL]
## 发现的新Bug(从用户日志)

```
16:19:03.667 Successfully marked party ready on attempt 2  
16:19:03.716 markPartyReady attempt 3 failed: cannot transition to ready status  
16:19:03.731 markPartyReady attempt 4 failed: cannot transition to ready status  
16:19:03.749 markPartyReady attempt 5 failed: cannot transition to ready status  
16:19:03.750 Cancelled job: progress_collection  💀
```

## 根本原因

Kotlin `repeat` 的陷阱:
- `return@repeat` 只是跳过当前迭代
- **不会退出整个循环**
- 导致第2次成功后,第3、4、5次继续执行
- 服务器返回 "already ready, cannot transition"
- 第5次失败,代码认为所有尝试都失败,停止 keygen

## 修复内容

在每次迭代开始时检查成功标志:
```kotlin
repeat(5) { attempt ->
    if (markReadySuccess) return@repeat  // ← 添加这一行!

    val markReadyResult = grpcClient.markPartyReady(sessionId, partyId)
    if (markReadyResult.isSuccess) {
        markReadySuccess = true
        return@repeat
    }
    ...
}
```

现在流程:
- 第1次:optimistic lock conflict → 延迟重试
- 第2次:成功 → 设置标志 → return@repeat
- 第3次:检查标志已成功 → 立即 return@repeat(跳过)
- 第4次:检查标志已成功 → 立即 return@repeat(跳过)
- 第5次:检查标志已成功 → 立即 return@repeat(跳过)
- 循环结束 → 检查标志 = true → 继续执行 keygen 

## 影响范围

修复了所有 markPartyReady 重试位置(6处):
- startKeygenAsInitiator
- joinKeygenViaGrpc
- startSignAsInitiator
- joinSignViaGrpc
- startSignAsJoiner
- 其他相关函数

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-27 00:24:40 -08:00
.claude fix(android): 使用 Kavascan Etherscan API 同步交易记录 2026-01-26 08:51:40 -08:00
backend fix(android): 修复 markPartyReady 重试逻辑的循环退出Bug [CRITICAL] 2026-01-27 00:24:40 -08:00
contracts feat(blockchain): 部署 eUSDT 和 fUSDT 代币合约 2026-01-19 05:30:25 -08:00
docs docs: 添加 RWADurian 2.0 部署与运维成本方案 2026-01-22 03:29:51 -08:00
frontend feat(batch-mining): 动态获取批量补发计算起始日期 2026-01-23 02:01:40 -08:00
kubernetes . 2025-11-25 10:29:24 +08:00
scripts fix(snapshot): 修改 Services PostgreSQL 用户名为 rwa_user 2026-01-08 09:05:22 -08:00
tests . 2025-11-25 10:29:24 +08:00
.gitignore feat(mining-ecosystem): 添加挖矿生态系统完整微服务与前端 2026-01-10 17:45:46 -08:00
README.md first commit 2025-11-23 21:21:44 -08:00
SEED01-qrcode.png fix: 短信超时返回成功状态避免前端报错 2025-12-21 20:55:31 -08:00
STKAITI.TTF feat(mobile-app): 添加合同签署 API 详细调试日志 2025-12-25 03:14:10 -08:00
contract.docx feat(kyc): 实名认证前检查手机号验证状态 2025-12-24 21:00:53 -08:00
docker-compose.yml first commit 2025-11-23 21:21:44 -08:00
挖矿.xlsx feat(contribution): 添加系统账户算力来源类型字段 2026-01-21 04:23:50 -08:00
榴莲皇后数据.xlsx fix(mobile-app): 修复多账号切换后账号列表只显示一个的问题 2025-12-27 11:12:50 -08:00
联合种植协议董事长_release_form.pdf fix(reporting-service): add /api/v1 prefix to wallet and reward service API calls 2026-01-04 23:18:10 -08:00

README.md