Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rpc): Refactor
getrawtransaction
& RPC error handling (#9049)
* clean-up: simplify the def of `MapServerError` * Use `HexData` instead of `String` for TXIDs * Remove a redundant test We don't need such a test anymore because the deserialization is handled by Serde now. * Adjust tests for using `HexData` * Make `height` and `confirmations` optional * Use legacy error codes * fmt * Remove unneeded error codes * Remove `zebra-rpc/src/constants.rs` * Rename `MapServerError` to `MapError` * Rename `OkOrServerError` to `OkOrError` * Allow specifying error codes when mapping errors * Allow setting error codes when mapping options * Use the right error code for `getrawtransaction` * fmt * Add docs for the error conversion traits * Refactor the error handling for `getblock` * Refactor error handling in `sendrawtransaction` * Refactor the error handling for `getblock` * Update the error handling for `getrawtransaction` * Refactor error handling for `z_gettreestate` * Refactor the error handling for address parsing * Refactor the error handling for getrawtransaction * Update `z_gettreestate` snapshots * Cosmetics * Refactor error handling in `getblock` * Refactor error handling in `getblockheader` * Simplify `getrawtransaction` * Check errors for `getrawtransaction` * fmt * Simplify proptests * Fix unit tests for `getaddresstxids` * Fix unit tests for `getaddressutxos` * fix docs * Update snapshots for `getrawtransaction` * Update zebra-rpc/src/server/error.rs Co-authored-by: Arya <[email protected]> * Use `transaction::Hash` instead of `HexData` * Simplify error handling * Update zebra-rpc/src/server/error.rs Co-authored-by: Alfredo Garcia <[email protected]> * Move a note on performance * Fix a typo * Use `String` instead of `transaction::Hash` * Adjust and add proptests * Reintroduce snapshots for invalid TXIDs * Don't derive `Serialize` & `Deserialize` for txids Deriving `serde::Serialize` & `serde::Deserialize` for `transaction::Hash` was superfluous, and we didn't need it anywhere in the code. --------- Co-authored-by: Arya <[email protected]> Co-authored-by: Alfredo Garcia <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information