use NULL_RLP, remove NULL_RLP_STATIC (#5742)
This commit is contained in:
parent
19f01194b1
commit
05aa960c25
@ -18,8 +18,6 @@
|
|||||||
use util::*;
|
use util::*;
|
||||||
use rlp::NULL_RLP;
|
use rlp::NULL_RLP;
|
||||||
|
|
||||||
static NULL_RLP_STATIC: [u8; 1] = [0x80; 1];
|
|
||||||
|
|
||||||
// combines a key with an address hash to ensure uniqueness.
|
// combines a key with an address hash to ensure uniqueness.
|
||||||
// leaves the first 96 bits untouched in order to support partial key lookup.
|
// leaves the first 96 bits untouched in order to support partial key lookup.
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -99,7 +97,7 @@ impl<'db> HashDB for AccountDB<'db>{
|
|||||||
|
|
||||||
fn get(&self, key: &H256) -> Option<DBValue> {
|
fn get(&self, key: &H256) -> Option<DBValue> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some(DBValue::from_slice(&NULL_RLP_STATIC));
|
return Some(DBValue::from_slice(&NULL_RLP));
|
||||||
}
|
}
|
||||||
self.db.get(&combine_key(&self.address_hash, key))
|
self.db.get(&combine_key(&self.address_hash, key))
|
||||||
}
|
}
|
||||||
@ -158,7 +156,7 @@ impl<'db> HashDB for AccountDBMut<'db>{
|
|||||||
|
|
||||||
fn get(&self, key: &H256) -> Option<DBValue> {
|
fn get(&self, key: &H256) -> Option<DBValue> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some(DBValue::from_slice(&NULL_RLP_STATIC));
|
return Some(DBValue::from_slice(&NULL_RLP));
|
||||||
}
|
}
|
||||||
self.db.get(&combine_key(&self.address_hash, key))
|
self.db.get(&combine_key(&self.address_hash, key))
|
||||||
}
|
}
|
||||||
@ -206,7 +204,7 @@ impl<'db> HashDB for Wrapping<'db> {
|
|||||||
|
|
||||||
fn get(&self, key: &H256) -> Option<DBValue> {
|
fn get(&self, key: &H256) -> Option<DBValue> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some(DBValue::from_slice(&NULL_RLP_STATIC));
|
return Some(DBValue::from_slice(&NULL_RLP));
|
||||||
}
|
}
|
||||||
self.0.get(key)
|
self.0.get(key)
|
||||||
}
|
}
|
||||||
@ -240,7 +238,7 @@ impl<'db> HashDB for WrappingMut<'db>{
|
|||||||
|
|
||||||
fn get(&self, key: &H256) -> Option<DBValue> {
|
fn get(&self, key: &H256) -> Option<DBValue> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some(DBValue::from_slice(&NULL_RLP_STATIC));
|
return Some(DBValue::from_slice(&NULL_RLP));
|
||||||
}
|
}
|
||||||
self.0.get(key)
|
self.0.get(key)
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ impl MemoryDB {
|
|||||||
/// when the refs > 0.
|
/// when the refs > 0.
|
||||||
pub fn raw(&self, key: &H256) -> Option<(DBValue, i32)> {
|
pub fn raw(&self, key: &H256) -> Option<(DBValue, i32)> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some((DBValue::from_slice(&NULL_RLP_STATIC), 1));
|
return Some((DBValue::from_slice(&NULL_RLP), 1));
|
||||||
}
|
}
|
||||||
self.data.get(key).cloned()
|
self.data.get(key).cloned()
|
||||||
}
|
}
|
||||||
@ -172,12 +172,10 @@ impl MemoryDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NULL_RLP_STATIC: [u8; 1] = [0x80; 1];
|
|
||||||
|
|
||||||
impl HashDB for MemoryDB {
|
impl HashDB for MemoryDB {
|
||||||
fn get(&self, key: &H256) -> Option<DBValue> {
|
fn get(&self, key: &H256) -> Option<DBValue> {
|
||||||
if key == &SHA3_NULL_RLP {
|
if key == &SHA3_NULL_RLP {
|
||||||
return Some(DBValue::from_slice(&NULL_RLP_STATIC));
|
return Some(DBValue::from_slice(&NULL_RLP));
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.data.get(key) {
|
match self.data.get(key) {
|
||||||
|
Loading…
Reference in New Issue
Block a user