Commit Graph

107 Commits

Author SHA1 Message Date
Aditya Kulkarni 994e8a05f2 Merge 'upstream/master' 2022-06-07 09:44:48 -05:00
Larry Ruane ba1b931986 add --sync-from-height command-line option
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.
2022-05-24 15:17:38 -05:00
Larry Ruane dfac02093d Fix V5 transaction txid (#392)
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.)
2022-05-24 09:23:15 -05:00
adityapk 98cb0ea9f2 cleanup locking for mempool 2022-05-16 13:33:43 -05:00
adityapk 3bec6d290c Timer to 30s 2022-05-13 11:12:12 -05:00
Steven Smith ab4c0fef70 Add support to GetTreeState to return Orchard final state 2022-05-10 23:21:26 -06:00
Aditya Kulkarni f6ea41cf9c v1.7.6 2022-04-07 10:50:50 -05:00
Aditya Kulkarni e146dbf5c2 Fix mempool issue 2022-04-07 10:20:01 -05:00
Larry Ruane bdaac63f3e improve reorg by using getbestblockhash 2021-08-30 16:41:24 -06:00
Aditya Kulkarni c1bab818a6 Fetch historical prices from coinbase 2021-08-30 10:43:49 -07:00
Larry Ruane b1f3687d83 add MempoolStream unit test 2021-07-29 13:47:53 -06:00
Larry Ruane 6357f7f15b Refactor mock Sleep, add mock Now time function
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.
2021-07-29 13:47:53 -06:00
Larry Ruane 503b9b256b modifications to adityapk00 mempool streaming API
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>
2021-07-29 13:47:53 -06:00
Aditya Kulkarni c3e1b98d4f Mempool Streaming API 2021-07-29 13:47:53 -06:00
Aditya Kulkarni 1b485256a3 Return hashes with getlatestblock 2021-07-26 13:11:02 -07:00
Aditya Kulkarni 7f81fcbf78 Monitor for 1-block reorgs as well 2021-07-26 10:33:28 -07:00
adityapk00 d461c18785
Mempool (#10)
* mempool streaming

* Fix deadlock

* return correct height

* Add mempool stream timeout

* buffer channel

* Mempool API

* comment
2021-07-14 14:46:20 -07:00
Larry Ruane a56af1cfbf GetBlockRange: allow start < end, return blocks in reverse order 2021-05-21 11:17:52 -07:00
Larry Ruane a4cc08b89e GetBlockRange: allow start < end, return blocks in reverse order 2021-05-18 15:38:26 -06:00
adityapk00 41ebe0e04b
Prices (#9)
* 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
2021-05-18 09:26:55 -07:00
Larry Ruane 4e561f2cfd add darksidewallet support for GetAddressUtxos
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
2021-04-26 11:42:03 -06:00
Aditya Kulkarni 3e2ba3c4c2 Fix vendor string 2021-04-21 10:45:34 -07:00
Aditya Kulkarni d28a129df9 Handle Params downloads on the HTTP server 2021-04-21 10:40:39 -07:00
adityapk00 f05fef2762 Merge fixes 2021-04-19 13:46:14 -07:00
adityapk00 0605b33e39 Merge 2021-04-19 13:38:25 -07:00
Larry Ruane dcad72ed25 generalize GetAddressUtxos to accept taddr list 2021-04-08 11:22:12 -06:00
Larry Ruane ad739ce055 allow Ping testing grpc only if explicitly enabled 2021-03-08 12:25:02 -07:00
Larry Ruane 5c5c4b882f check disk write return values 2021-03-08 11:21:33 -07:00
Larry Ruane c7c5da1fda don't log method names to stderr unless --grpc-logging-insecure 2021-03-08 11:12:26 -07:00
Larry Ruane a69537cf2b restore coinbase height check
The reason that it had to be disabled has gone away. This provides more
security by ensuring that the blocks we receive from zcashd are valid.
2021-01-15 16:49:22 -07:00
Larry Ruane 82045d493a fix GetTaddressBalance (json problem) 2021-01-15 14:05:27 -07:00
Larry Ruane 97d57395b2 fix GetTaddressTxids() 2021-01-12 16:18:29 -07:00
Larry Ruane d7f35f2713 fix database file location bug introduced by PR320
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.
2021-01-11 12:19:51 -07:00
Larry Ruane 33e7312218 add zcashd versioning to GetLightdInfo result 2020-12-03 22:55:08 -07:00
Larry Ruane 063287888f add more version information to GetLightdInfo result 2020-10-06 10:03:37 -06:00
Larry Ruane ac1bf8481c refactor Reverse(), no functional changes 2020-09-14 10:31:17 -06:00
Larry Ruane 7381129740 add GetMempoolTx() 2020-09-10 14:01:01 -06:00
Larry Ruane 1c6d8a46f7 gracefully handle syncing zcashd (no REORG) 2020-06-26 08:35:35 -06:00
Ben Wilson 63f01502e8 Added option to provide Zcashd RPC parameters from flags 2020-06-08 09:03:21 -04:00
Larry Ruane ead5415693 bump version to 0.4.1, release notes, small fixes 2020-06-05 17:16:36 -06:00
Larry Ruane 31a19484e2
Improve error checking, README improvements (#278)
Deserialize blocks and transactions as they are staged, to catch errors
earlier (such as trying to stage transactions as blocks), improve logging,
improve error handling (don't crash if ApplyStaged is given a height
that's higher than one beyond the latest active block).
2020-06-03 19:18:04 -06:00
Larry Ruane faca1ecbef
increase the 252 per-block transaction limit (#273) 2020-06-03 18:58:26 -06:00
Taylor Hornby 2d8a55c53f Fix missing hex encoding of darksidewalletd's sendrawtransaction response 2020-05-28 16:05:43 -06:00
Larry Ruane b47c0ddf99 fix corruption detector, smallest block is 74 bytes, not 78 2020-05-22 08:30:03 -06:00
Larry Ruane 1dd63f2ca8 add --darkside-timeout option to override 30-minute default shutdown 2020-05-21 11:48:03 -06:00
Larry Ruane 0217670d8c add logging for darkside rpcs 2020-05-21 11:48:03 -06:00
Larry Ruane 007dbbf13c fix first block hash 2020-05-21 11:48:03 -06:00
Larry Ruane 2f0b2054ba Fix transaction staging
The following works:

grpcurl -plaintext -d '{"saplingActivation": 663150,"branchID": "bad", "chainName":"x"}' localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/Reset
grpcurl -plaintext -d '{"height":663150,"nonce":5,"count":3}' localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/StageBlocksCreate
grpcurl -plaintext -d '{"height":663152,"url":"https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/t-shielded-spend"}' localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/StageTransactions
grpcurl -plaintext -d '{"height":663152}' localhost:9067 cash.z.wallet.sdk.rpc.DarksideStreamer/ApplyStaged
grpcurl -plaintext -d '{"height":663152}' localhost:9067 cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock
(shows the block with one transaction)
2020-05-21 11:48:03 -06:00
Larry Ruane 7ac1a3f983 small improvements to transaction stuff, small fixes 2020-05-21 11:48:03 -06:00
Larry Ruane 3defdcd1ee Improve error handling 2020-05-21 11:48:03 -06:00