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

Commit

Permalink
Merge pull request #247 from ethcore/fix_suicide
Browse files Browse the repository at this point in the history
Fixing suicide with self-refund to be consistent with CPP.
  • Loading branch information
arkpar committed Jan 27, 2016
2 parents 7fefc15 + 6403287 commit b858fc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion res/ethereum/tests
Submodule tests updated 32 files
+391 −390 BasicTests/difficultyCustomHomestead.json
+3,601 −7,440 BasicTests/difficultyFrontier.json
+3,600 −7,440 BasicTests/difficultyHomestead.json
+3,600 −7,440 BasicTests/difficultyMorden.json
+3,600 −7,440 BasicTests/difficultyOlimpic.json
+0 −6,077 BlockchainTests/Homestead/bcInvalidRLPTest.json
+1,685 −1,685 BlockchainTests/Homestead/bcWalletTest.json
+271 −281 StateTests/Homestead/stCallCodes.json
+38 −38 StateTests/Homestead/stCallCreateCallCodeTest.json
+209 −217 StateTests/Homestead/stCallDelegateCodes.json
+190 −198 StateTests/Homestead/stCallDelegateCodesCallCode.json
+0 −2,637 StateTests/Homestead/stDelegatecallTest.json
+5 −5 StateTests/Homestead/stHomeSteadSpecific.json
+17 −17 StateTests/Homestead/stInitCodeTest.json
+46 −46 StateTests/Homestead/stLogTests.json
+6 −6 StateTests/Homestead/stMemoryStressTest.json
+65 −65 StateTests/Homestead/stMemoryTest.json
+89 −89 StateTests/Homestead/stPreCompiledContracts.json
+15 −15 StateTests/Homestead/stQuadraticComplexityTest.json
+2 −2 StateTests/Homestead/stRecursiveCreate.json
+17 −17 StateTests/Homestead/stRefundTest.json
+9 −9 StateTests/Homestead/stSpecialTest.json
+74 −66 StateTests/Homestead/stSystemOperationsTest.json
+40 −40 StateTests/Homestead/stTransactionTest.json
+84 −84 StateTests/Homestead/stWalletTest.json
+292 −869 StateTests/stCallCodes.json
+13 −5 StateTests/stCallCreateCallCodeTest.json
+16 −8 StateTests/stSystemOperationsTest.json
+11 −11 StateTests/stTransitionTest.json
+1 −1 TransactionTests/Homestead/tt10mbDataField.json
+57 −57 TransactionTests/Homestead/ttTransactionTest.json
+69 −69 TransactionTests/Homestead/ttWrongRLPTransaction.json
8 changes: 7 additions & 1 deletion src/externalities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
self.state.transfer_balance(&address, refund_address, &balance);
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);
}

Expand Down

0 comments on commit b858fc6

Please sign in to comment.