From 6f5d3838346752dc9bf28bd85bd11648b99aa84b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 14 Jan 2016 22:45:50 +0100 Subject: [PATCH] Storage should kill zero entries. --- src/account.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/account.rs b/src/account.rs index 0923692d1..44a07738b 100644 --- a/src/account.rs +++ b/src/account.rs @@ -187,7 +187,10 @@ impl Account { if f == &Filth::Dirty { // cast key and value to trait type, // so we can call overloaded `to_bytes` method - t.insert(k, &encode(&U256::from(v.as_slice()))); + match v.is_zero() { + true => t.remove(k), + false => t.insert(k, &encode(&U256::from(v.as_slice()))), + } *f = Filth::Clean; } }