Skip to content

Commit 43895a6

Browse files
committed
More tweaks
1 parent b79efbd commit 43895a6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sdk/pubkey/src/lib.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn derive_address<const N: usize>(
6161
i += 1;
6262
}
6363

64-
// TODO: replace this with `as_slice` when the msrv is upgraded
64+
// TODO: replace this with `as_slice` when the MSRV is upgraded
6565
// to `1.84.0+`.
6666
let bump_seed = [bump.unwrap_or_default()];
6767

@@ -138,11 +138,17 @@ pub const fn derive_address_const<const N: usize>(
138138
i += 1;
139139
}
140140

141-
if bump.is_some() {
142-
hasher = hasher.update(&[bump.unwrap()]);
141+
// TODO: replace this with `is_some` when the MSRV is upgraded
142+
// to `1.84.0+`.
143+
if let Some(bump) = bump {
144+
hasher
145+
.update(&[bump])
146+
.update(program_id)
147+
.update(PDA_MARKER)
148+
.finalize()
149+
} else {
150+
hasher.update(program_id).update(PDA_MARKER).finalize()
143151
}
144-
145-
hasher.update(program_id).update(PDA_MARKER).finalize()
146152
}
147153

148154
/// Convenience macro to define a static `Pubkey` value.

0 commit comments

Comments
 (0)