Commit Graph

78 Commits

Author SHA1 Message Date
Larry Ruane 7971992989 darkside GetTreeState gRPC: support block hash or height
In production mode, the `GetTreeState` gRPC supports block specification
by either height or block hash. But until now, darkside emulation only
supports height. This commit adds support for block hash.

It also allows entries to be deleted (darkside `RemoveTreeState`) by
block hash (not just height).
2023-09-04 14:22:44 -06:00
Jack Grigg 8269810eee darkside: Store, track, and expose commitment tree sizes 2023-08-16 10:34:38 -06:00
Jack Grigg b805382ac3 Only pass `limit` argument to `z_getsubtreesbyindex` if `maxEntries > 0`
We also remove the `i < maxEntries` bound on returned results, as the
`limit` parameter already causes `zcashd` to bound its returned entries.

Closes zcash/lightwalletd#444.
2023-07-11 17:26:59 -06:00
Jack Grigg f0e4c27ed6 Bring in latest `compact_formats.proto`
From zcash/librustzcash@c13c8c6678,
including the rework of how the commitment tree sizes are to be
represented in CompactBlocks.
2023-07-04 11:05:41 -06:00
Larry Ruane c506123a08 add GetSubtreeRoots() gRPC 2023-06-27 21:14:59 -06:00
Larry Ruane 214d4a8475 add GetBlockNullifier and GetBlockRangeNullifiers #406
These return compact blocks with only the transactions' nullifiers
remaining. This affects both Orchard and Sapling transactions.
2023-06-05 15:19:08 -06:00
Larry Ruane de8b6230ba extend darksidewallet locking
See https://github.com/zcash/lightwalletd/issues/433
2023-05-27 07:53:12 -06:00
Larry Ruane 478ec3e361 fix frontend unit test TestGetLatestBlock
This test was broken by PR 415.
2023-02-14 13:43:48 -07:00
Dimitris Apostolou 07fd6a966a Fix typos 2023-01-02 13:11:15 -07:00
Larry Ruane 4267cc9754 fix GetLatestBlock() gRPC (pure block cache)
See issue 397. If the block cache is still populating (lightwalletd is
syncing with zcashd), behave the same as if the cache was fully
populated, other than performance.

This turned out to affect only the GetLatestBlock() gRPC. Previously, it
would return the height and hash of the latest block in the cache. After
this commit, it queries zcashd using the getblockchaininfo, which
contains both of those values.

GetBlock() (and GetBlockRange()) already worked correctly; if the
requested block isn't in the cache, it requests it from zcashd.
2022-10-20 10:04:05 -06:00
Francisco Gindre 15fe0ced86 [#390] Support for GetTreeState on Darksidewalletd
This commit adds support for adding/removing/clearing TreeState
structs for lightwalletd to return as if they were TreeState
messages requested to Zcashd for a given height.

Closes #390
2022-08-29 14:24:14 -06:00
Larry Ruane 2d3943b8e9 add required locking (mutex) to GetMempoolTx 2022-07-21 11:31:03 -06:00
Larry Ruane af0f348a57 Fix GetMempoolTx bug returning no entries
This was broken by PR 393, which changed how txids are determined.
2022-07-21 11:23:55 -06:00
Larry Ruane db2795aad7 add GetLatestTreeState() grpc 2022-06-23 19:01:34 -06:00
Larry Ruane 0d00588941 Get unit tests working again
Now "go test ./..." passes, it had broken due to the V5 transaction
(NU5) changes in #392. I didn't have time to fix the tests at the time.
Also, this fixes a few lint problems.
2022-06-12 12:50:42 -06:00
Steven Smith ab4c0fef70 Add support to GetTreeState to return Orchard final state 2022-05-10 23:21:26 -06:00
Larry Ruane 83bb19918f restore gRPC GetMempoolTx
This was removed as part of PR #358 (commit "remove gRPC GetMempoolTx")
but should not have been, so it's being restored.
2021-12-09 15:26:55 -07:00
adityapk00 33d3d53d34 Verify rawtx 2021-09-07 14:25:20 -06:00
Larry Ruane 4f00783f48 remove gRPC GetMempoolTx
This RPC has never been used, and is now superceded by GetMempoolStream.
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 39179a9721 Return hashes from getlatestblock 2021-07-26 23:20:05 -06: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
Larry Ruane dcad72ed25 generalize GetAddressUtxos to accept taddr list 2021-04-08 11:22:12 -06:00
Larry Ruane 17c47cfebe call checkTaddress() for each given taddress 2021-03-08 12:25:02 -07:00
Larry Ruane 824cb8dc8e check SplitN() return value to prevent indexing beyond end of slice 2021-03-08 12:25:02 -07:00
Larry Ruane ad739ce055 allow Ping testing grpc only if explicitly enabled 2021-03-08 12:25:02 -07:00
Larry Ruane 86a76a96cb check txid (hash0 length argument, must be 64 2021-03-08 11:23:05 -07:00
Larry Ruane 22dda4a28d check all json.Unmarshal() error returns 2021-03-08 11:14:48 -07:00
Larry Ruane d9d12998b2 remove error logging that client requests can cause 2021-03-08 10:51:31 -07:00
Larry Ruane 82045d493a fix GetTaddressBalance (json problem) 2021-01-15 14:05:27 -07:00
Larry Ruane acca1a7c80 Update protoc grpc toolchain to latest
I installed the latest toolchain according to:
https://grpc.io/docs/languages/go/quickstart/

I updated the protoc command line arguments in Makefile based on
that quickstart guide, then I ran: make update-grpc

This has set the tool version (which you can see at the top of
any .pb.go file) to:

protoc-gen-go v1.25.0
protoc        v3.14.0
2021-01-05 18:20:10 -07:00
Dimitris Apostolou b450634ab7 Fix typos 2020-12-21 13:03:41 -07:00
Larry Ruane 33e7312218 add zcashd versioning to GetLightdInfo result 2020-12-03 22:55:08 -07:00
Larry Ruane 1712bde1bc add gRPC GetAddressUtxos 2020-10-28 13:09:59 -06:00
Larry Ruane c66521335f add GetTreeState gRPC (for checkpoints) 2020-10-28 12:55:38 -06:00
Larry Ruane 20105167b8 GetBlockRange, GetTaddressTxids segfault: add checking for nil (null) arguments 2020-10-07 15:38:47 -06:00
Larry Ruane 063287888f add more version information to GetLightdInfo result 2020-10-06 10:03:37 -06:00
Larry Ruane 1906e1d1eb fix GetTransaction (broken in "add GetMempool()" commit) 2020-10-06 09:36:22 -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 6aa9bdfc40 refactor GetTaddressBalance* functions to eliminate duplicated code 2020-08-19 13:05:23 -06:00
Larry Ruane 4443b64071 rename GetAddress* to GetTAddress* (review) 2020-08-19 13:05:23 -06:00
Larry Ruane dda62f948c Modification requested by review
- renamed GetAddressBalance to GetAddressBalanceStream
- changed GetAddressBalance argument to repeated (string) rather than
streaming
- rename balance field to valueZat (consistent with zcashd)
2020-08-19 13:05:23 -06:00
Larry Ruane 97840c8ec7 add GetAddressBalance gRPC 2020-08-19 13:05:23 -06:00
Larry Ruane f72a6d8eba add error check to StageBlocksStream 2020-05-29 10:36:34 -06:00
Kevin Gorham 6b0c1cc43e Fixes GetTransaction returning base64 hex values. 2020-05-28 17:01:00 -06:00
Larry Ruane 7ac1a3f983 small improvements to transaction stuff, small fixes 2020-05-21 11:48:03 -06:00
Larry Ruane 6ddd894a96 change vendor string from ECC DarkWalletD to ECC DarksideWalletD 2020-05-21 11:48:03 -06:00
Larry Ruane 39348100a9 fix StageTransactions, vendor = ECC LightWalletD 2020-05-21 11:48:03 -06:00