Instead of the Sleep function pointer being a standalong global
variable, move it into a new Time struct, and add a Now function
pointer, so that time.Now() can be mocked. Time.Now() isn't used yet.
This will be cleaner if we need to mock more time-related functions in
the future.
This commit is based on adityapk00 streaming mempool interface but
avoids using goroutines, which are difficult to reason about.
Co-authored-by: Aditya Kulkarni <adityapk@gmail.com>
PR 320 introduced a bug that causes the `blocks` and `lengths` database
files to be located one directory level higher than it they should be.
The bug doesn't cause any functional problem, it only makes the
lightwalletd do more work (re-download the block cache), and it also
makes it not possible to switch between testnet and mainnet.
This patch locates the database files back where they belong.
- improved corruption recovery (don't back up by just 1 block at a time)
- move darksidewallet gRPCs to their own .proto file
- this force-push removes my commits for reorg testing using SetState