zebra/zebra-chain/src
Alfredo Garcia f39ac48c59
feature(rpc): Implement `getbestblockhash` method (#3754)
* 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

* feature(rpc): add `getbestblockhash` RPC method

* feature(rpc): Add a `pub struct SerializedBlockHash` type

* tests(rpc): add a unit test for `getbestblockhash` method

* tests(rpc): make sure no requests are sent to mempool in getbestblockhash test

* tests(rpc): refactor check

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

* fix(rpc): fixes after rebase

* refactor(rpc): refactor `GetBestBlockHash`

* fix(rpc): unused variables

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

* docs(rpc): update

* fix(rpc): add panic

* fix(rpc): fix panic

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-03-11 05:13:08 +00:00
..
amount Check remaining transaction value & make value balance signs match the spec (#2566) 2021-08-09 14:22:26 -03:00
block feature(rpc): Implement `getbestblockhash` method (#3754) 2022-03-11 05:13:08 +00:00
chain_tip Estimate network chain tip height based on local node time and current best tip (#3492) 2022-02-11 01:27:02 +00:00
history_tree refactor(anchorSapling): Change type to force consensus rule validation (#3544) 2022-02-17 03:20:22 +00:00
orchard fix(shielded): use RwLock for note commitment tree root caches (#3809) 2022-03-09 23:26:49 +00:00
parameters lint(clippy): warn on manual printing to stdout or stderr (#3767) 2022-03-08 09:14:15 +00:00
primitives feat: get addresses from transparent outputs (#3802) 2022-03-11 03:23:04 +00:00
sapling fix(shielded): use RwLock for note commitment tree root caches (#3809) 2022-03-09 23:26:49 +00:00
serialization Support large block heights (#3401) 2022-02-11 00:32:57 +00:00
sprout fix(shielded): use RwLock for note commitment tree root caches (#3809) 2022-03-09 23:26:49 +00:00
transaction Refactor `SentTransactionHash` to be a stricter type (#3706) 2022-03-08 09:14:21 +00:00
transparent feat: get addresses from transparent outputs (#3802) 2022-03-11 03:23:04 +00:00
value_balance Split ValueBalance methods into NegativeAllowed and NonNegative (#2649) 2021-08-20 13:30:38 +00:00
work lint: add extra integer lints, and partially fix some code (#3409) 2022-01-27 11:34:15 -03:00
amount.rs Check remaining transaction value & make value balance signs match the spec (#2566) 2021-08-09 14:22:26 -03:00
block.rs feature(rpc): implement getblock api call (#3707) 2022-03-10 01:12:41 +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
fmt.rs Add a TypeNameToDebug formatter to zebra_chain (#2466) 2021-07-09 12:40:19 +10:00
history_tree.rs Tweak some assertions to better match their error messages (#2822) 2021-10-04 10:31:56 -03:00
lib.rs Consolidate standard lints into a cargo config file (#3386) 2022-01-24 16:25:06 +00:00
orchard.rs ZIP 212: validate Sapling and Orchard output of coinbase transactions (#3029) 2021-11-11 22:18:37 +00:00
parameters.rs Cleanup a few arbitrary impls (#2222) 2021-05-28 09:49:28 -03:00
primitives.rs ZIP 212: validate Sapling and Orchard output of coinbase transactions (#3029) 2021-11-11 22:18:37 +00:00
sapling.rs Update multiple crates to ensure bitvec 0.22.3 is being used (#2351) 2021-06-23 13:16:22 +10:00
serialization.rs Refactor addr v1 serialization using a separate AddrV1 type (#3021) 2021-11-10 06:47:50 +10:00
shutdown.rs Fix shutdown panics (#1637) 2021-02-03 19:03:28 +10:00
sprout.rs Validate JoinSplit proofs (#3128) 2021-12-10 16:33:15 +00:00
transaction.rs docs: Transaction consensus rules: Size rules (#3461) 2022-02-08 20:28:40 +00:00
transparent.rs feat: get addresses from transparent outputs (#3802) 2022-03-11 03:23:04 +00:00
value_balance.rs Enforce Rust edition 2021 (#3332) 2022-01-14 12:10:18 +00:00
work.rs Replace primitives_types with uint (#2350) 2021-06-18 15:35:05 -03:00