-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
821 additions
and
252 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! Block verifier request type. | ||
use std::sync::Arc; | ||
|
||
use zebra_chain::block::Block; | ||
|
||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
/// A request to the chain or block verifier | ||
pub enum Request { | ||
/// Performs semantic validation, then asks the state to perform contextual validation and commit the block | ||
Commit(Arc<Block>), | ||
|
||
#[cfg(feature = "getblocktemplate-rpcs")] | ||
/// Performs semantic validation but skips checking proof of work, | ||
/// then asks the state to perform contextual validation. | ||
/// Does not commit the block to the state. | ||
CheckProposal(Arc<Block>), | ||
} | ||
|
||
impl Request { | ||
/// Returns inner block | ||
pub fn block(&self) -> Arc<Block> { | ||
Arc::clone(match self { | ||
Request::Commit(block) => block, | ||
|
||
#[cfg(feature = "getblocktemplate-rpcs")] | ||
Request::CheckProposal(block) => block, | ||
}) | ||
} | ||
|
||
/// Returns `true` if the request is a proposal | ||
pub fn is_proposal(&self) -> bool { | ||
match self { | ||
Request::Commit(_) => false, | ||
|
||
#[cfg(feature = "getblocktemplate-rpcs")] | ||
Request::CheckProposal(_) => true, | ||
} | ||
} | ||
} |
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.