gballet / multiproof-rs

A rust implementation of Alexey Akhunov's multiproof algorithm
Apache License 2.0
32 stars 8 forks source link

insert can now overwrite leaves #53

Closed gballet closed 4 years ago

gballet commented 4 years ago

Add an overwrite field to insert, which if set to true will overwrite an existing leaf.

s1na commented 4 years ago

Are there use-cases where you'd want overwrite to be false? My initial thought was the method should insert if a key doesn't exist and update the existing leaf otherwise.

gballet commented 4 years ago

I am trying to do something like immutability: by default, nothing should be overwritten. This is because we could envision some attacks in which a proof has two entries setting the same key. But the way the tree is rebuilt at the moment doesn't have this problem. So I'll do it the way you suggest.