Check for NULL_RLP in AccountDB

This commit is contained in:
arkpar 2016-03-13 21:28:57 +01:00
parent 48df41a30a
commit 420f473f90
1 changed files with 9 additions and 0 deletions

View File

@ -97,6 +97,9 @@ impl<'db> HashDB for AccountDBMut<'db>{
}
fn insert(&mut self, value: &[u8]) -> H256 {
if value == &NULL_RLP {
return SHA3_NULL_RLP.clone();
}
let k = value.sha3();
let ak = combine_key(&self.address, &k);
self.db.emplace(ak, value.to_vec());
@ -104,11 +107,17 @@ impl<'db> HashDB for AccountDBMut<'db>{
}
fn emplace(&mut self, key: H256, value: Bytes) {
if key == SHA3_NULL_RLP {
return;
}
let key = combine_key(&self.address, &key);
self.db.emplace(key, value.to_vec())
}
fn kill(&mut self, key: &H256) {
if key == &SHA3_NULL_RLP {
return;
}
let key = combine_key(&self.address, key);
self.db.kill(&key)
}