Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

use NULL_RLP, remove NULL_RLP_STATIC #5742

Merged
merged 1 commit into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions ethcore/src/account_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
use util::*;
use rlp::NULL_RLP;

static NULL_RLP_STATIC: [u8; 1] = [0x80; 1];

// combines a key with an address hash to ensure uniqueness.
// leaves the first 96 bits untouched in order to support partial key lookup.
#[inline]
Expand Down Expand Up @@ -99,7 +97,7 @@ impl<'db> HashDB for AccountDB<'db>{

fn get(&self, key: &H256) -> Option<DBValue> {
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))
}
Expand Down Expand Up @@ -158,7 +156,7 @@ impl<'db> HashDB for AccountDBMut<'db>{

fn get(&self, key: &H256) -> Option<DBValue> {
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))
}
Expand Down Expand Up @@ -206,7 +204,7 @@ impl<'db> HashDB for Wrapping<'db> {

fn get(&self, key: &H256) -> Option<DBValue> {
if key == &SHA3_NULL_RLP {
return Some(DBValue::from_slice(&NULL_RLP_STATIC));
return Some(DBValue::from_slice(&NULL_RLP));
}
self.0.get(key)
}
Expand Down Expand Up @@ -240,7 +238,7 @@ impl<'db> HashDB for WrappingMut<'db>{

fn get(&self, key: &H256) -> Option<DBValue> {
if key == &SHA3_NULL_RLP {
return Some(DBValue::from_slice(&NULL_RLP_STATIC));
return Some(DBValue::from_slice(&NULL_RLP));
}
self.0.get(key)
}
Expand Down
6 changes: 2 additions & 4 deletions util/src/memorydb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl MemoryDB {
/// when the refs > 0.
pub fn raw(&self, key: &H256) -> Option<(DBValue, i32)> {
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()
}
Expand Down Expand Up @@ -172,12 +172,10 @@ impl MemoryDB {
}
}

static NULL_RLP_STATIC: [u8; 1] = [0x80; 1];

impl HashDB for MemoryDB {
fn get(&self, key: &H256) -> Option<DBValue> {
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) {
Expand Down