-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Lines 179 to 191 in ed1cb9c
| // Check if a venue with this (type, wallet) already exists (possibly with a different ID) | |
| existingVenue, err := s.queries.GetVenueByTypeAndWallet(ctx, sqlcgen.GetVenueByTypeAndWalletParams{ | |
| Type: defaultHyperliquidVenueType, | |
| Wallet: wallet, | |
| }) | |
| if err == nil { | |
| // A venue with this (type, wallet) already exists. | |
| // If it has a different ID than the default, we should use it instead of trying to create a duplicate. | |
| if existingVenue.ID != string(defaultHyperliquidVenueID) { | |
| // There's already a user-defined venue with this type and wallet. | |
| // No need to create a separate default venue - just return success. | |
| return nil | |
| } |
When an existing venue with the same (type, wallet) is found, the new logic returns early without inserting or updating the default row (hyperliquid:default). Downstream code (e.g. EnsureDefaultVenueWallet, order identifier construction, and default venue lookups) expects this well-known ID to exist. If an operator already has a venue for the primary wallet under a different ID, startup will skip the upsert and later lookups by hyperliquid:default will fail with sql.ErrNoRows. Instead of returning immediately, the routine should reconcile the existing venue into the default ID or update it in place so the canonical identifier always exists.
Metadata
Metadata
Assignees
Labels
No labels