zebra/zebra-state/src/service
Alfredo Garcia 833560411f
feature(rpc): implement getblock api call (#3707)
* feature(rpc): start adding a `getblock` method

* fix(rpc): replace oneshot

* fix(rpc): replace a panic with error

* fix(rpc): fix test

* feature(rpc): add hex to response

* refactor(rpc): use generic instead of alias

* docs(rpc): improve docs for getblock method

* test(rpc): add a test for getblock method

* deps(rpc): remove non needed tower features

Co-authored-by: teor <teor@riseup.net>

* docs(rpc): add a note to getblock doc

* refactor(rpc): replace alias

* fix(rpc): use `zcash_serialize_to_vec()` instead of logging format

* tests(rpc): add network argument to `populated_state()`

* refactor(rpc): use an error for state service readiness

* fix(rpc): add parameter

* fix(rpc): clippy

* nit(rpc): remove new line from imports

* fix(rpc): remove commented code

* fix(rpc): simplify error

Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

* Use a `SerializedBlock` type to help serializing blocks (#3725)

* Create a `SerializedBlock` helper type

Create a type that can be used as a byte slice, but is guaranteed to
represent a valid block.

* Use `into_iter` instead of `iter`

There's no need to borrow the elements, they can be moved out directly.
This will be necessary because `&Arc<T>` doesn't implement `Borrow<T>`,
so a `SerializedBlock` can't be built directly from an `&Arc<Block>`.

* Use `SerializedBlock` in `GetBlock`

Make the type stricter to avoid storing possibly invalid values. The
bytes are still serialized as a hexadecimal string, through the usage of
`hex`.

The `serde::Deserialize` can't be derived because `hex` requires the
type to also implement `FromHex`.

* feature(rpc): add suggestions from code review

Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

* tests(rpc): make sure mempool has no requests in get_block test

* fix(rpc): change height argument type in getblock method

* fix(rpc): rustfmt

* fix(rpc): replace panic

* fix(rpc): change getblock response

* fix(rpc): fix lightwalletd test

* tests(rpc): add a getblock error test

* fix(rpc): try another regex

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-03-10 01:12:41 +00:00
..
chain_tip Stop panicking when using sync and async methods on the same ChainTipChange (#2800) 2021-09-28 07:48:19 -03:00
check Document consensus rules from 3.9 Nullifier Sets (#3521) 2022-02-16 10:00:26 +00:00
finalized_state 4. test(db): add large transaction tests (#3759) 2022-03-09 23:34:50 +00:00
non_finalized_state 3. refactor(state): move database reads and writes to a new zebra_db module (#3579) 2022-02-23 00:43:41 +00:00
arbitrary.rs ZIP-221/244 auth data commitment validation in checkpoint verifier (#2633) 2021-08-23 14:17:33 +00:00
chain_tip.rs Estimate network chain tip height based on local node time and current best tip (#3492) 2022-02-11 01:27:02 +00:00
check.rs Document second part of consensus rules from 7.6 Block Header Encoding and Consensus (#3566) 2022-02-19 02:22:35 +00:00
finalized_state.rs 4. test(db): add large transaction tests (#3759) 2022-03-09 23:34:50 +00:00
non_finalized_state.rs 3. refactor(state): move database reads and writes to a new zebra_db module (#3579) 2022-02-23 00:43:41 +00:00
pending_utxos.rs Fix typos (#3314) 2022-01-04 11:25:00 +01:00
tests.rs feature(rpc): implement getblock api call (#3707) 2022-03-10 01:12:41 +00:00