This fixes issue #480. Enabling this option decreases the performance of
gRPCs GetBlock and GetBlockRange, but conserves disk space (the size of
the database is currently around 17GB).
Note, specifying this option will also delete the existing cache (so if
you start again without --nocache, the cache will need to be recreated).
This causes lightwalletd to discard cached blocks at the given height
and beyond. This in turn causes it to re-fetch those blocks from zcashd.
It's similar to --redownload, except that option discards all blocks
(equivalent to --sync-from-height 0, but the existing --redownload is
retained for compatibility).
This is mostly intended for testing. It's sometimes useful to force the
node to (re)sync some recent blocks, but redownloading all of them takes
around an hour.
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
Co-authored-by: Aditya Kulkarni <adityapk@gmail.com>
also to pick up changes to walletrpc/service.proto
(regenerate compact_formats.pb.go service.pb.go)
cd walletrpc
protoc compact_formats.proto --go_out=plugins=grpc:.
protoc service.proto --go_out=plugins=grpc:.
ran go mod tidy && go mod vendor