Skip to content

Commit ffdcd0a

Browse files
committed
add note cmt conversion methods to byte array
1 parent d8ed57b commit ffdcd0a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

masp_primitives/src/sapling.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ impl Node {
9696
Node { repr }
9797
}
9898

99+
/// Convert this node into its byte vector representation.
100+
pub const fn into_repr(self) -> [u8; 32] {
101+
self.repr
102+
}
103+
99104
/// Constructs a new note commitment tree node from a [`bls12_381::Scalar`]
100105
pub fn from_scalar(cmu: bls12_381::Scalar) -> Self {
101106
Self {
@@ -104,6 +109,12 @@ impl Node {
104109
}
105110
}
106111

112+
impl AsRef<[u8; 32]> for Node {
113+
fn as_ref(&self) -> &[u8; 32] {
114+
&self.repr
115+
}
116+
}
117+
107118
impl incrementalmerkletree::Hashable for Node {
108119
fn empty_leaf() -> Self {
109120
Node {

0 commit comments

Comments
 (0)