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.
This is a shortcut fix. Instead of replicating the zip244 transaction
logic that's implemented in librustzcash:
zcash_primitives/src/transaction/components/orchard.rs
cheat by calling getblock with verbose level 1, which prints the txid
of each transaction. This currently requires calling getblock twice,
once for the raw hex (as we have always done), and again to get the
transaction IDs. An easy improvement would be to add the raw hex to
verbosity 1 result. (Or have a new verbosity that shows both.)
In previous commit, I forgot to include Orchard transactions in compact
blocks (so they will now include transactions with either Sapling or
Orchard transactions).
This is a non-functional change. Instead of `rawTransaction` (which
carries the result of parsing a full transaction from zcashd) containing
slices of _pointers_ to separately-allocated memory (one allocation for
each spend, for example), allocate a slice of spends (one contiguous
range of memory). A quick benchmark shows sync improves by about 8%.
TODO:
- store, instead of just skip over, nu5 transaction fields
- add relevant nu5 fields to CompactBlock
- restore disabled V4 unit tests
- add V5 test vectors to unit tests
The reason most of the V4 transaction and block unit tests are removed
is that they used V3 transactions, which lightwalletd never sees in
production, since lightwalletd starts at Sapling activation (which has
V4 transactions). So these tests were always wrong, in a way. This
commit simplifies the parsing code by removing support for V3 (since it
was never needed). The tests need to be updated to V4, but we'll do
that in a later PR.
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>
* Prices API
* Add current prices
* Historical prices persist
* Add mutexs
* multiple providers
* Handle startup
* Edge case where historical price is requested for current
* fix median edge case
* Don't return too old last price
* bug fixes
* price metrics and logging
* warnings
Add a new darksidewallet gRPC to add a utxo that can be returned by the
production GetAddressUtxos, for example:
grpcurl -plaintext -d '{"address":"t1g1HQJuwDoStGrYYLj8VhLu1J5igd8TNXV","txid":"1zjB42Z7FtwRZOBNMlTubCgx9l3dsZSqXxmWpuZXJto=","script": "dqkU8saQsCVS4mNwcByoGCtfOaHFaCiIrA==","valueZat": "3010000","height": "686773"}' localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/AddAddressUtxo
Then the following returns this entry:
grpcurl -plaintext -d '{"startHeight":0,"maxEntries":2,"addresses":["t1g1HQJuwDoStGrYYLj8VhLu1J5igd8TNXV"]}' localhost:9067 cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos
You can also clear the list of entries:
grpcurl -plaintext localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/ClearAddressUtxo