-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change(utils): Add a direct connection mode to zebra-checkpoints (#6516)
* Rename variables so it's clearer what they do * Fully document zebra-checkpoints arguments * Remove some outdated references to zcashd * Add a json-conversion feature for converting JSON to valid Heights * Simplify zebra-checkpoints code using conversion methods * Track the last checkpoint height rather than the height gap * Move all the CLI-specific code into a single function * Remove cfg(feature) from the test RPC client API * Move the RpcRequestClient into zebra-node-services * Fix the case of RpcRequestClient * Add transport and addr arguments to zebra-checkpoints * Make zebra-checkpoints support both CLI and direct JSON-RPC connections * Fix RpcRequestClient compilation * Add a suggestion for zcashd authentication failures * Document required features * Handle differences in CLI & direct parameter and response formats * Replace a custom function with an existing dependency function * Add a checkpoint list test for minimum height gaps
- Loading branch information
Showing
25 changed files
with
485 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//! Consensus-critical conversion from JSON [`Value`] to [`Height`]. | ||
use serde_json::Value; | ||
|
||
use crate::BoxError; | ||
|
||
use super::{Height, TryIntoHeight}; | ||
|
||
impl TryIntoHeight for Value { | ||
type Error = BoxError; | ||
|
||
fn try_into_height(&self) -> Result<Height, Self::Error> { | ||
if self.is_number() { | ||
let height = self.as_u64().ok_or("JSON value outside u64 range")?; | ||
return height.try_into_height(); | ||
} | ||
|
||
if let Some(height) = self.as_str() { | ||
return height.try_into_height(); | ||
} | ||
|
||
Err("JSON value must be a number or string".into()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.