Merge pull request #247 from ethcore/fix_suicide

Fixing suicide with self-refund to be consistent with CPP.
This commit is contained in:
Arkadiy Paronyan 2016-01-27 19:34:13 +01:00
commit b858fc6e4b
2 changed files with 8 additions and 2 deletions

@ -1 +1 @@
Subproject commit e838fd90998fc5502d0b7c9427a4c231f9a6953d
Subproject commit dc86e6359675440aea59ddb48648a01c799925d8

View File

@ -215,7 +215,13 @@ impl<'a> Ext for Externalities<'a> {
fn suicide(&mut self, refund_address: &Address) {
let address = self.origin_info.address.clone();
let balance = self.balance(&address);
if &address == refund_address {
// TODO [todr] To be consisted with CPP client we set balance to 0 in that case.
self.state.sub_balance(&address, &balance);
} else {
trace!("Suiciding {} -> {} (xfer: {})", address, refund_address, balance);
self.state.transfer_balance(&address, refund_address, &balance);
}
self.substate.suicides.insert(address);
}