fix(savedata): add recovery hint to integrity check failure log

Admins importing saves from another server instance will hit the
hash mismatch error with no guidance. The log message now tells them
to set DisableSaveIntegrityCheck=true or null the hash for the
specific character via SQL.
This commit is contained in:
Houmgaor
2026-03-23 10:15:25 +01:00
parent 3803fd431b
commit 1f0544fd10

View File

@@ -59,7 +59,9 @@ func GetCharacterSaveData(s *Session, charID uint32) (*CharacterSaveData, error)
if storedHash != nil && !s.server.erupeConfig.DisableSaveIntegrityCheck { if storedHash != nil && !s.server.erupeConfig.DisableSaveIntegrityCheck {
computedHash := sha256.Sum256(saveData.decompSave) computedHash := sha256.Sum256(saveData.decompSave)
if !bytes.Equal(storedHash, computedHash[:]) { if !bytes.Equal(storedHash, computedHash[:]) {
s.logger.Error("Savedata integrity check failed: hash mismatch", s.logger.Error("Savedata integrity check failed: hash mismatch — "+
"if this character was imported from another server, set DisableSaveIntegrityCheck=true in config.json "+
"or run: UPDATE characters SET savedata_hash = NULL WHERE id = <charID>",
zap.Uint32("charID", charID), zap.Uint32("charID", charID),
zap.Binary("stored_hash", storedHash), zap.Binary("stored_hash", storedHash),
zap.Binary("computed_hash", computedHash[:]), zap.Binary("computed_hash", computedHash[:]),