Closed gballet closed 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.
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.
Add an
overwrite
field toinsert
, which if set totrue
will overwrite an existing leaf.