chore: expose atomic_operation
This commit is contained in:
parent
75151c168b
commit
0cefd63734
11
rln/rln.go
11
rln/rln.go
|
@ -470,3 +470,14 @@ func (r *RLN) SetMetadata(metadata []byte) error {
|
|||
func (r *RLN) GetMetadata() ([]byte, error) {
|
||||
return r.w.GetMetadata()
|
||||
}
|
||||
|
||||
// AtomicOperation can be used to insert and remove elements into the merkle tree
|
||||
func (r *RLN) AtomicOperation(index MembershipIndex, idCommsToInsert []IDCommitment, indicesToRemove []MembershipIndex) error {
|
||||
idCommBytes := serializeCommitments(idCommsToInsert)
|
||||
indicesBytes := serializeIndices(indicesToRemove)
|
||||
execSuccess := r.w.AtomicOperation(index, idCommBytes, indicesBytes)
|
||||
if !execSuccess {
|
||||
return errors.New("could not execute atomic_operation")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue