holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.06k stars 85 forks source link

xor-distance error ("Inputs should have the same length") #11

Closed staltz closed 5 years ago

staltz commented 5 years ago

I ran example-s.js in multiserver-dht on branch hyperswarm, with node v10.1.0, and got the error:

./multiserver-dht/node_modules/xor-distance/index.js:4
  if (a.length !== b.length) throw new Error('Inputs should have the same length')
                                   ^

Error: Inputs should have the same length
    at dist (./multiserver-dht/node_modules/xor-distance/index.js:4:36)
    at QueryTable.addUnverified (./multiserver-dht/node_modules/dht-rpc/lib/query-table.js:15:21)
    at QueryStream._onresponse (./multiserver-dht/node_modules/dht-rpc/lib/query-stream.js:80:20)
    at IO._finish (./multiserver-dht/node_modules/dht-rpc/lib/io.js:131:9)
    at IO._onmessage (./multiserver-dht/node_modules/dht-rpc/lib/io.js:103:14)
    at UTP.emit (events.js:182:13)
    at UTP._onmessage (./multiserver-dht/node_modules/@hyperswarm/network/node_modules/utp-native/index.js:191:8)
mafintosh commented 5 years ago

Are putting in a 32 byte buffer as the topic? That is needed (we should assert this)

staltz commented 5 years ago

Oh, I'll try that. Also the docs should mention the length requirement.