chore: expose get_leaf

This commit is contained in:
Richard Ramos 2023-07-31 13:59:26 -04:00
parent d761ca9911
commit d7831a9c95
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
6 changed files with 14 additions and 1 deletions

Binary file not shown.

View File

@ -94,6 +94,8 @@ bool set_metadata(struct RLN *ctx, const struct Buffer *input_buffer);
bool get_metadata(const struct RLN *ctx, struct Buffer *output_buffer);
bool flush(struct RLN *ctx);
bool hash(const struct Buffer *input_buffer, struct Buffer *output_buffer);
bool poseidon_hash(const struct Buffer *input_buffer, struct Buffer *output_buffer);

View File

@ -222,3 +222,14 @@ func (r *RLN) GetRoot() ([]byte, error) {
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len)), nil
}
func (r *RLN) GetLeaf(index uint) ([]byte, error) {
var output []byte
out := toBuffer(output)
if !bool(C.get_leaf(r.ptr, C.uintptr_t(index), &out)) {
return nil, errors.New("could not get the leaf")
}
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len)), nil
}

@ -1 +1 @@
Subproject commit 8a365f0c9e5c4a744f70c5dd4904ce8d8f926c34
Subproject commit 6d583200777aa94131e687e1797af0ba568a66dc