Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions packages/wasm-utxo/cli/src/psbt/create_zcash_v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@ pub fn handle_create_zcash_v6_command(
let consensus_branch_id =
parse_u32_flexible(&consensus_branch_id).context("invalid --consensus-branch-id")?;

// v6 (Ironwood) is only valid at or after NU6.3 activation, and NU6.3 is currently the
// latest defined upgrade — so the only branch id that satisfies "at or after" today is
// NU6.3's own. Reject anything else rather than building an unshieldable PSBT the CLI's
// later steps would fail on with a less obvious error.
let nu6_3_branch_id = NetworkUpgrade::Nu6_3.branch_id();
if consensus_branch_id != nu6_3_branch_id {
// v6 (Ironwood) is only valid at or after NU6.3 activation. Reject any branch id that
// doesn't correspond to NU6.3 or later, rather than building a PSBT the CLI's later steps
// would fail on with a less obvious error.
let valid_branch_ids: &[u32] = &[
NetworkUpgrade::Nu6_3.branch_id(),
NetworkUpgrade::Nu7.branch_id(),
];
if !valid_branch_ids.contains(&consensus_branch_id) {
bail!(
"--consensus-branch-id 0x{consensus_branch_id:08x} is not at or after NU6.3 \
(Ironwood) activation (expected 0x{nu6_3_branch_id:08x})"
(Ironwood) activation (expected one of: {})",
valid_branch_ids
.iter()
.map(|id| format!("0x{id:08x}"))
.collect::<Vec<_>>()
.join(", ")
);
}

Expand Down
Loading