ssbc / ssb-blobs

blob gossiping ssb-subprotocol
MIT License
12 stars 11 forks source link

strangely named variable or bug? #33

Open mixmix opened 3 years ago

mixmix commented 3 years ago

https://github.com/ssbc/ssb-blobs/blob/master/inject.js#L106

the signature of queue is queue(id, hops) , but here it's used like queue(id, size)

need to read closed what blobs.ls is returning but this could be bug?

mixmix commented 3 years ago

The readme explains that data is passed around like { blobId: (Size|Hops) }

The way the two are distinguished is that hops are always encoding as negative (< 0) and size as positive.

Super dense. I think I may like to separate out size and hops logic to increase readability and avoid bugs