mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-15 06:32:05 +00:00
fix(multiplayer): validate ranked arena paths durably
This commit is contained in:
@@ -49,6 +49,18 @@ func RankedArenaForProposal(proposalID string) RankedArena {
|
||||
return rankedArenas[rankedArenaOrder[int(digest[0])%len(rankedArenaOrder)]]
|
||||
}
|
||||
|
||||
// IsRankedArenaPath is the durable-store boundary for arena paths. Proposal
|
||||
// and allocation records must not accept a merely non-empty caller supplied
|
||||
// scene path, even when the caller bypasses matcher formation.
|
||||
func IsRankedArenaPath(path string) bool {
|
||||
for _, arena := range rankedArenas {
|
||||
if arena.Path == path {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ValidateRankedAdmission(participants []RankedParticipant, arena RankedArena) error {
|
||||
if len(participants) != 6 || !validRankedArena(arena) {
|
||||
return fmt.Errorf("ranked admission requirements not met")
|
||||
|
||||
Reference in New Issue
Block a user