Fixing suicide with self-refund to be consistent with CPP.
This commit is contained in:
parent
ed546006ef
commit
382b22b93b
@ -215,8 +215,13 @@ impl<'a> Ext for Externalities<'a> {
|
|||||||
fn suicide(&mut self, refund_address: &Address) {
|
fn suicide(&mut self, refund_address: &Address) {
|
||||||
let address = self.origin_info.address.clone();
|
let address = self.origin_info.address.clone();
|
||||||
let balance = self.balance(&address);
|
let balance = self.balance(&address);
|
||||||
trace!("Suiciding {} -> {} (xfer: {})", address, refund_address, balance);
|
if &address == refund_address {
|
||||||
self.state.transfer_balance(&address, refund_address, &balance);
|
// 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);
|
self.substate.suicides.insert(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user