diff --git a/internal/controller/ledger/log_process.go b/internal/controller/ledger/log_process.go index acd04094a..78e0ead70 100644 --- a/internal/controller/ledger/log_process.go +++ b/internal/controller/ledger/log_process.go @@ -52,8 +52,12 @@ func forgeLog[INPUT any, OUTPUT ledger.LogPayload](ctx context.Context, store St return nil, err } if err == nil { - if computedHash := ledger.ComputeIdempotencyHash(parameters.Input); log.IdempotencyHash != computedHash { - return nil, newErrInvalidIdempotencyInputs(log.IdempotencyKey, log.IdempotencyHash, computedHash) + // notes(gfyrag): idempotency hash should never be empty in this case, but data from previous + // ledger version does not have this field and it cannot be recomputed + if log.IdempotencyHash != "" { + if computedHash := ledger.ComputeIdempotencyHash(parameters.Input); log.IdempotencyHash != computedHash { + return nil, newErrInvalidIdempotencyInputs(log.IdempotencyKey, log.IdempotencyHash, computedHash) + } } return pointer.For(log.Data.(OUTPUT)), nil diff --git a/internal/storage/bucket/migrations/19-logs-add-idempotency-hash.sql b/internal/storage/bucket/migrations/19-logs-add-idempotency-hash.sql index f1eedaa79..fe7709ff5 100644 --- a/internal/storage/bucket/migrations/19-logs-add-idempotency-hash.sql +++ b/internal/storage/bucket/migrations/19-logs-add-idempotency-hash.sql @@ -1,3 +1,2 @@ ---todo: add special traitement on code when value is empty alter table "{{.Bucket}}".logs add column idempotency_hash bytea; \ No newline at end of file