From c94f3e4d83d02c4b60494a132cb35faa70dff89f Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 29 Dec 2025 11:47:37 -0800 Subject: [PATCH] =?UTF-8?q?debug(service-party-app):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20TSS=20=E8=BF=9B=E7=A8=8B=E8=AF=A6=E7=BB=86=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 输出二进制文件路径和存在性检查 - 输出传递给 TSS 的参与者列表 JSON - 输出完整的命令行参数 - 收集并输出 stderr 内容 - 帮助诊断 TSS 进程 exit code 1 问题 Generated with Claude Code Co-Authored-By: Claude Opus 4.5 --- .../electron/modules/tss-handler.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/mpc-system/services/service-party-app/electron/modules/tss-handler.ts b/backend/mpc-system/services/service-party-app/electron/modules/tss-handler.ts index 433e1364..3a0d09f4 100644 --- a/backend/mpc-system/services/service-party-app/electron/modules/tss-handler.ts +++ b/backend/mpc-system/services/service-party-app/electron/modules/tss-handler.ts @@ -198,12 +198,16 @@ export class TSSHandler extends EventEmitter { return new Promise((resolve, reject) => { try { const binaryPath = this.getTSSBinaryPath(); + console.log(`[TSS] Binary path: ${binaryPath}`); + console.log(`[TSS] Binary exists: ${fs.existsSync(binaryPath)}`); // 构建参与者列表 JSON const participantsJson = JSON.stringify(participants); + console.log(`[TSS] Participants: ${participantsJson}`); + console.log(`[TSS] partyIndex=${partyIndex}, threshold=${threshold.t}-of-${threshold.n}`); // 启动 TSS 子进程 - this.tssProcess = spawn(binaryPath, [ + const args = [ 'keygen', '--session-id', sessionId, '--party-id', partyId, @@ -212,9 +216,13 @@ export class TSSHandler extends EventEmitter { '--threshold-n', threshold.n.toString(), '--participants', participantsJson, '--password', encryptionPassword, - ]); + ]; + console.log(`[TSS] Spawning: ${binaryPath} ${args.join(' ')}`); + + this.tssProcess = spawn(binaryPath, args); let resultData = ''; + let stderrData = ''; // 如果没有预订阅,现在订阅消息 // 如果已经预订阅,消息监听器已经注册,不需要重复注册 @@ -254,7 +262,9 @@ export class TSSHandler extends EventEmitter { // 处理标准错误 this.tssProcess.stderr?.on('data', (data: Buffer) => { - console.error('[TSS Error]', data.toString()); + const errorText = data.toString(); + stderrData += errorText; + console.error('[TSS stderr]', errorText); }); // 处理进程退出 @@ -289,7 +299,9 @@ export class TSSHandler extends EventEmitter { reject(new Error(`Failed to parse keygen result: ${e}`)); } } else { - reject(new Error(`Keygen process exited with code ${code}`)); + const errorMsg = stderrData.trim() || `Keygen process exited with code ${code}`; + console.error(`[TSS] Process failed: code=${code}, stderr=${stderrData}`); + reject(new Error(errorMsg)); } });