Skip to content

Commit

Permalink
Add nonce option for leaderlog so you can have an un-sync'd db
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewWestberg committed Jan 3, 2024
1 parent f3c0f39 commit 4a77003
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 292 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cncli"
version = "6.0.0-alpha4"
version = "6.0.0-alpha5"
authors = ["Andrew Westberg <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
50 changes: 32 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ pub mod nodeclient {
help = "Epoch number where we transition from Byron to Shelley. -1 means guess based on genesis files"
)]
shelley_transition_epoch: i64,
#[structopt(
long,
help = "Provide a nonce value in lower-case hex instead of calculating from the db"
)]
nonce: Option<String>,
},
Sendtip {
#[structopt(
Expand Down Expand Up @@ -312,8 +317,9 @@ pub mod nodeclient {
ref timezone,
ref consensus,
ref shelley_transition_epoch,
ref nonce,
} => {
leaderlog::calculate_leader_logs(
if let Err(error) = leaderlog::calculate_leader_logs(
db,
byron_genesis,
shelley_genesis,
Expand All @@ -328,7 +334,10 @@ pub mod nodeclient {
false,
consensus,
shelley_transition_epoch,
);
nonce,
) {
handle_error(error);
}
}
Command::Nonce {
ref db,
Expand All @@ -337,22 +346,27 @@ pub mod nodeclient {
ref extra_entropy,
ref ledger_set,
ref shelley_transition_epoch,
} => leaderlog::calculate_leader_logs(
db,
byron_genesis,
shelley_genesis,
&0u64,
&0u64,
&0f64,
extra_entropy,
ledger_set,
"nonce",
&PathBuf::new(),
"America/Los_Angeles",
true,
"praos",
shelley_transition_epoch,
),
} => {
if let Err(error) = leaderlog::calculate_leader_logs(
db,
byron_genesis,
shelley_genesis,
&0u64,
&0u64,
&0f64,
extra_entropy,
ledger_set,
"nonce",
&PathBuf::new(),
"America/Los_Angeles",
true,
"praos",
shelley_transition_epoch,
&None,
) {
handle_error(error);
}
}
Command::Sendtip {
ref config,
ref cardano_node,
Expand Down
Loading

0 comments on commit 4a77003

Please sign in to comment.