mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-15 03:52:04 +00:00
fix: validate durable result submissions
This commit is contained in:
@@ -57,6 +57,13 @@ func (r PostgresResults) SubmitResult(ctx context.Context, resultID string, resu
|
||||
if r.DB == nil || resultID == "" || binding.ServerID == "" || binding.MatchID != result.MatchID || binding.ServerID != result.ServerID || len(payload) == 0 || now.IsZero() {
|
||||
return fmt.Errorf("invalid result submission")
|
||||
}
|
||||
validator, err := domain.NewResultStore(binding)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, _, err := validator.Submit(resultID, result, binding, now); err != nil {
|
||||
return err
|
||||
}
|
||||
receipt := domain.ResultReceipt{ResultID: resultID, MatchID: result.MatchID, ResultNonce: result.ResultNonce, PayloadDigest: domain.ResultDigest(result), IntegrityState: result.IntegrityState, ReceivedAt: now}
|
||||
return CompleteResult(ctx, r.DB, receipt, binding.ServerID, resultID, payload, now)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user