ssbc / ssb-db

A database of unforgeable append-only feeds, optimized for efficient replication for peer to peer protocols
https://scuttlebot.io/
MIT License
1.17k stars 75 forks source link

Using opts in createLogStream() screws with sublevel #13

Closed pfrazee closed 10 years ago

pfrazee commented 10 years ago

Providing an opts object causes createLogStream to read values from the toplevel database, not the 'log` sublevel. The subsequent map from log-item to message fails, causing the stream to emit a 'Key not found in database' error.

dominictarr commented 10 years ago

with any opts object? Can you make a breaking test?

pfrazee commented 10 years ago

Sure 2secs

pfrazee commented 10 years ago

Committed (95427923a0e56ba4). It looks like this only occurs if gt == 0.

dominictarr commented 10 years ago

oh, this is the problem: https://github.com/dominictarr/level-sublevel/blob/master/nut.js#L168-L171

it's a falsey check, but of course 0 is falsey so it needs to check whether the property is defined since both null and undefined are valid bytewise types

dominictarr commented 10 years ago

okay this is fixed now!

pfrazee commented 10 years ago

+1

On Wed, Aug 27, 2014 at 4:51 PM, Dominic Tarr notifications@github.com wrote:

okay this is fixed now!

— Reply to this email directly or view it on GitHub https://github.com/dominictarr/secure-scuttlebutt/issues/13#issuecomment-53646205 .