Helia not using bitswap even though dialed to nodes

Thinking about it more, another way to do this is just to configure a router that always yields your bootstrap nodes as providers for any given CID - that way you can still use sessions, you don’t have to worry about remaining connected to the bootstrappers & you don’t even have to configure them as bootstrap nodes:

import { createHelia } from 'helia'
import { multiaddr } from '@multiformats/multiaddr'
import { peerIdFromString } from '@libp2p/peer-id'

helia = await createHelia({
  // other config
  routers: [{
    async * findProviders() {
      yield * [
        FLUORINE_WEBSOCKETS,
        BISMUTH_WEBSOCKETS,
        CERIUM_WEBSOCKETS
      ].map(ma => {
        const address = multiaddr(ma)
        const id = peerIdFromString(address.getPeerId() ?? '')

        return {
          id,
          multiaddrs: [
            address
          ]
        }
      })
    }
  }]
})
1 Like