bitcoinjs/bitcoinjs-server — pull request #108 by MidnightLightning (2013-06-07 21:12:45+00:00)
Title: Leveldb fixing

This updates several calls in the LevelDown storage to properly use the `keyNotFound` function to treat `err` results that are simple "Not Found: " errors not as critical errors.

After applying this update, the block slowdown that I was experiencing ([issue 103](https://github.com/bitcoinjs/bitcoinjs-server/issues/103)) stopped happening. I think this was due to calls to `getBlocksByHash` or `getBlocksByHeight` (the plural functions) were returning the "Not Found" error if any one of the blocks in the request set was not found, effectively saying the whole mess of blocks requested was not found.

This update allows the array of values to be returned to the callback function, just the missing blocks are `undefined` entries in the return array instead (which I think is the expected result).

`getBlocksByHeight` is only used in one place outside the storage utility itself (getting a list of blocks to validate a timestamp is within the median as part of the difficulty retargeting process), and it uses `getBlocksByHash` as part of that process (nothing else uses `getBlocksByHash` currently).