EIP-86 fixes (#5506)

This commit is contained in:
Arkadiy Paronyan
2017-05-05 16:00:40 +02:00
committed by Gav Wood
parent 8b9adb4d74
commit ed7c366b90
9 changed files with 32 additions and 26 deletions

View File

@@ -433,6 +433,11 @@ impl<B: Backend> State<B> {
self.ensure_cached(a, RequireCache::None, false, |a| a.map_or(false, |a| !a.is_null()))
}
/// Determine whether an account exists and has code.
pub fn exists_and_has_code(&self, a: &Address) -> trie::Result<bool> {
self.ensure_cached(a, RequireCache::CodeSize, false, |a| a.map_or(false, |a| a.code_size().map_or(false, |size| size != 0)))
}
/// Get the balance of account `a`.
pub fn balance(&self, a: &Address) -> trie::Result<U256> {
self.ensure_cached(a, RequireCache::None, true,