@bsv/sdk 1.8.3 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -176,7 +176,9 @@ export default class LookupResolver {
176
176
  this.networkPreset = config.networkPreset ?? 'mainnet'
177
177
  this.facilitator = config.facilitator ?? new HTTPSOverlayLookupFacilitator(undefined, this.networkPreset === 'local')
178
178
  this.slapTrackers = config.slapTrackers ?? (this.networkPreset === 'mainnet' ? DEFAULT_SLAP_TRACKERS : DEFAULT_TESTNET_SLAP_TRACKERS)
179
- this.hostOverrides = config.hostOverrides ?? {}
179
+ const hostOverrides = config.hostOverrides ?? {}
180
+ this.assertValidOverrideServices(hostOverrides)
181
+ this.hostOverrides = hostOverrides
180
182
  this.additionalHosts = config.additionalHosts ?? {}
181
183
 
182
184
  // cache tuning
@@ -375,4 +377,12 @@ export default class LookupResolver {
375
377
  const firstKey = m.keys().next().value
376
378
  if (firstKey !== undefined) m.delete(firstKey)
377
379
  }
380
+
381
+ private assertValidOverrideServices (overrides: Record<string, string[]>): void {
382
+ for (const service of Object.keys(overrides)) {
383
+ if (!service.startsWith('ls_')) {
384
+ throw new Error(`Host override service names must start with "ls_": ${service}`)
385
+ }
386
+ }
387
+ }
378
388
  }