Fix for removal of a fatdb value.
This commit is contained in:
parent
13cae436e4
commit
42bf34fff5
|
@ -84,7 +84,7 @@ where
|
||||||
let out = self.raw.insert(hash.as_ref(), value)?;
|
let out = self.raw.insert(hash.as_ref(), value)?;
|
||||||
let db = self.raw.db_mut();
|
let db = self.raw.db_mut();
|
||||||
|
|
||||||
// don't insert if it doesn't exist.
|
// insert if it doesn't exist.
|
||||||
if out.is_none() {
|
if out.is_none() {
|
||||||
let aux_hash = H::hash(hash.as_ref());
|
let aux_hash = H::hash(hash.as_ref());
|
||||||
db.emplace(aux_hash, DBValue::from_slice(key));
|
db.emplace(aux_hash, DBValue::from_slice(key));
|
||||||
|
@ -96,9 +96,10 @@ where
|
||||||
let hash = H::hash(key);
|
let hash = H::hash(key);
|
||||||
let out = self.raw.remove(hash.as_ref())?;
|
let out = self.raw.remove(hash.as_ref())?;
|
||||||
|
|
||||||
// don't remove if it already exists.
|
// remove if it already exists.
|
||||||
if out.is_some() {
|
if out.is_some() {
|
||||||
self.raw.db_mut().remove(&hash);
|
let aux_hash = H::hash(hash.as_ref());
|
||||||
|
self.raw.db_mut().remove(&aux_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(out)
|
Ok(out)
|
||||||
|
|
Loading…
Reference in New Issue