From 453a592f140c64ab1523f62f9fee5e6a4f1bcbcb Mon Sep 17 00:00:00 2001 From: Dragan Pilipovic Date: Fri, 26 Jan 2024 00:55:38 +0100 Subject: [PATCH] add empty case --- ffi_interface/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ffi_interface/src/lib.rs b/ffi_interface/src/lib.rs index fc1429e..1dc5cdb 100644 --- a/ffi_interface/src/lib.rs +++ b/ffi_interface/src/lib.rs @@ -137,6 +137,11 @@ pub fn update_commitment_sparse( } let delta_commitment = committer.commit_sparse(delta_values); + + // If commitment is empty, then we are creating a new commitment. + if old_commitment_bytes == [0u8; 64] { + return Ok(delta_commitment.to_bytes_uncompressed()); + } Ok((delta_commitment + old_commitment).to_bytes_uncompressed()) }