-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add estimate of machine power to
networking_state
Estimate which kind of proofs the host-machine is capable of generating: LockScript (very cheap), ProofCollection (possible on regular computers), SingleProof (only possible on very powerful machines). What to do with transactions before sending them to peers or inserting them into the mempool will be determined based on this parameter. Co-authored-by: Alan Szepieniec <[email protected]>
- Loading branch information
1 parent
6b2d21f
commit 1702caa
Showing
7 changed files
with
163 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
use std::str::FromStr; | ||
|
||
use clap::error::ErrorKind; | ||
use clap::Parser; | ||
|
||
#[derive(Parser, Debug, Clone, Copy)] | ||
pub enum TxProvingCapability { | ||
LockScript, | ||
ProofCollection, | ||
SingleProof, | ||
} | ||
|
||
impl FromStr for TxProvingCapability { | ||
type Err = clap::Error; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s { | ||
"lockscript" => Ok(TxProvingCapability::LockScript), | ||
"proofcollection" => Ok(TxProvingCapability::ProofCollection), | ||
"singleproof" => Ok(TxProvingCapability::SingleProof), | ||
_ => Err(clap::Error::raw( | ||
ErrorKind::InvalidValue, | ||
"Invalid machine proving power", | ||
)), | ||
} | ||
} | ||
} |
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