From cdf858520d2dee02fa9b4ed4754b71ce4b46da69 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 15 Dec 2025 10:20:43 -0800 Subject: [PATCH] =?UTF-8?q?revert(scripts):=20=E6=81=A2=E5=A4=8D=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=88=B0JWT=E8=AE=A4=E8=AF=81=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E4=BF=AE=E6=94=B9username?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- backend/scripts/init-hot-wallet.sh | 63 ------------------------------ 1 file changed, 63 deletions(-) diff --git a/backend/scripts/init-hot-wallet.sh b/backend/scripts/init-hot-wallet.sh index 9a469841..7021fec4 100644 --- a/backend/scripts/init-hot-wallet.sh +++ b/backend/scripts/init-hot-wallet.sh @@ -351,69 +351,6 @@ get_public_key() { echo " 公钥: ${PUBLIC_KEY:0:16}...${PUBLIC_KEY: -16}" } -# 验证并修复账户 username -# mpc-system 的 createAccountFromKeygen 会自动生成 wallet-xxx 格式的 username -# 需要查询并更新为用户指定的 username -verify_and_fix_username() { - log_info "验证账户 username..." - - # 等待账户创建完成 (session-coordinator 异步创建) - sleep 3 - - # 直接通过数据库查询和更新 (最可靠的方式) - log_info "通过数据库查询账户..." - - # 查询通过 keygen_session_id 创建的账户 - local db_query_result=$(docker exec mpc-postgres psql -U postgres -d mpc_system -t -A -c \ - "SELECT id, username FROM accounts WHERE keygen_session_id = '$SESSION_ID' LIMIT 1;" 2>/dev/null) || { - log_warn "无法连接到 mpc-postgres 数据库" - log_warn "可能 Docker 容器未运行或名称不同" - return - } - - log_debug "数据库查询结果: $db_query_result" - - if [ -z "$db_query_result" ]; then - log_warn "未找到 keygen_session_id=$SESSION_ID 对应的账户" - log_warn "session-coordinator 可能尚未创建账户,等待 5 秒后重试..." - sleep 5 - - db_query_result=$(docker exec mpc-postgres psql -U postgres -d mpc_system -t -A -c \ - "SELECT id, username FROM accounts WHERE keygen_session_id = '$SESSION_ID' LIMIT 1;" 2>/dev/null) - - if [ -z "$db_query_result" ]; then - log_error "仍未找到账户,请检查 session-coordinator 日志" - return - fi - fi - - # 解析结果 (格式: id|username) - local account_id=$(echo "$db_query_result" | cut -d'|' -f1) - local current_username=$(echo "$db_query_result" | cut -d'|' -f2) - - ACCOUNT_ID="$account_id" - log_debug "找到账户: id=$account_id, username=$current_username" - - # 检查 username 是否需要更新 - if [ "$current_username" == "$USERNAME" ]; then - log_success "账户 username 已正确: $USERNAME" - return - fi - - log_info "更新账户 username: $current_username -> $USERNAME" - - # 直接通过数据库更新 username - local update_result=$(docker exec mpc-postgres psql -U postgres -d mpc_system -t -A -c \ - "UPDATE accounts SET username = '$USERNAME' WHERE id = '$account_id' RETURNING username;" 2>/dev/null) - - if [ "$update_result" == "$USERNAME" ]; then - log_success "账户 username 已更新为: $USERNAME" - else - log_error "更新 username 失败" - log_debug "更新结果: $update_result" - fi -} - # 派生 EVM 地址 derive_address() { log_info "派生 EVM 地址..."