From a9d5adf78f1213ca9f058588ae3f4ba4b040f41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Mon, 2 Nov 2026 20:58:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(library):=20=E4=BD=BF=E7=94=A8=E7=82=B9?= =?UTF-8?q?=E6=A0=B8=E5=AF=B9=E6=81=A2=E5=A4=8D=E7=9B=AE=E6=A0=87=E6=8C=87?= =?UTF-8?q?=E7=BA=B9=E8=80=8C=E9=9D=9E=E7=BB=B4=E6=8A=A4=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=8C=87=E7=BA=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/postgres/library_restore_dispatch.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/platform/postgres/library_restore_dispatch.go b/internal/platform/postgres/library_restore_dispatch.go index 0132d27..66bba0b 100644 --- a/internal/platform/postgres/library_restore_dispatch.go +++ b/internal/platform/postgres/library_restore_dispatch.go @@ -123,15 +123,21 @@ WHERE target_identity=$1 AND protocol_version=1 FOR UPDATE`, targetIdentity).Sca if revoked != nil { return fmt.Errorf("%w(目标 %s 的激活已于 %s 撤销)", ErrRestoreDispatchNotActivated, targetIdentity, revoked.UTC().Format(time.RFC3339)) } - if rowFingerprint != targetFingerprint { - return fmt.Errorf("%w(目标 %s 的激活绑定指纹 %s,本次恢复目标指纹 %s)", - ErrRestoreDispatchNotActivated, targetIdentity, rowFingerprint, targetFingerprint) - } var record restoreDispatchActivationRecord if err := json.Unmarshal([]byte(evidenceRaw), &record); err != nil { return fmt.Errorf("parse restore dispatch activation record: %w", err) } verified := record.Verified + // 激活行的 target_fingerprint 列是**维护窗口**指纹;binding 带的是本次恢复对 + // 目标做的只读观察值。两层不能相互顶替,否则正常恢复会被窗口指纹误拒。 + if rowFingerprint != verified.TargetFingerprint { + return fmt.Errorf("%w(目标 %s 的激活行指纹 %s 与登记证据 %s 不一致)", + ErrRestoreDispatchNotActivated, targetIdentity, rowFingerprint, verified.TargetFingerprint) + } + if verified.RestoreTargetFingerprint != targetFingerprint { + return fmt.Errorf("%w(目标 %s 的激活登记恢复目标指纹 %s,本次恢复目标指纹 %s)", + ErrRestoreDispatchNotActivated, targetIdentity, verified.RestoreTargetFingerprint, targetFingerprint) + } authority, primary, _, err := observedGovernanceAuthority(ctx, tx) if err != nil { return err