diff --git a/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt b/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt index 096c1bc0..7d372fdb 100644 --- a/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt +++ b/backend/mpc-system/services/service-party-android/app/src/main/java/com/durian/tssparty/data/remote/GrpcClient.kt @@ -593,6 +593,15 @@ class GrpcClient @Inject constructor() { partyRole: String = "temporary", version: String = "1.0.0" ): Result = withContext(Dispatchers.IO) { + // 必须等待 channel READY 后才能注册 + Log.d(TAG, "registerParty: Waiting for channel READY...") + val isReady = waitForChannelReady(CONNECTION_TIMEOUT_SECONDS * 1000) + if (!isReady) { + Log.e(TAG, "registerParty: Channel not ready after timeout") + return@withContext Result.failure(Exception("Channel not ready")) + } + Log.d(TAG, "registerParty: Channel is READY, proceeding with registration") + // Save for re-registration registeredPartyId = partyId registeredPartyRole = partyRole