Skip to content

Commit

Permalink
Do not allow MASP_TEST_SEED to be used outside of testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
murisi committed Feb 22, 2024
1 parent 4af94d5 commit 5b8140a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/sdk/src/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,8 @@ impl<U: ShieldedUtils + MaybeSend + MaybeSync> ShieldedContext<U> {
let memo = MemoBytes::empty();

// Try to get a seed from env var, if any.
let rng = StdRng::from_rng(OsRng).unwrap();
#[cfg(feature = "testing")]
let rng = if let Ok(seed) = env::var(ENV_VAR_MASP_TEST_SEED)
.map_err(|e| Error::Other(e.to_string()))
.and_then(|seed| {
Expand All @@ -2319,7 +2321,7 @@ impl<U: ShieldedUtils + MaybeSend + MaybeSync> ShieldedContext<U> {
);
StdRng::seed_from_u64(seed)
} else {
StdRng::from_rng(OsRng).unwrap()
rng
};

// Now we build up the transaction within this object
Expand Down

0 comments on commit 5b8140a

Please sign in to comment.