Browse Source

Fix for state transition when collision occurs.

cl-refactor
Gav Wood 11 years ago
parent
commit
277ca86bd1
  1. 10
      libethereum/State.cpp

10
libethereum/State.cpp

@ -641,11 +641,11 @@ void State::executeBare(Transaction const& _t, Address _sender)
if (balance(_sender) < _t.value + fee)
throw NotEnoughCash();
// Increment associated nonce for sender.
noteSending(_sender);
if (_t.receiveAddress)
{
// Increment associated nonce for sender.
noteSending(_sender);
subBalance(_sender, _t.value + fee);
addBalance(_t.receiveAddress, _t.value);
@ -659,7 +659,6 @@ void State::executeBare(Transaction const& _t, Address _sender)
catch (VMException const& _e)
{
cnote << "VM Exception: " << _e.description();
throw;
}
}
}
@ -677,6 +676,9 @@ void State::executeBare(Transaction const& _t, Address _sender)
if (isContractAddress(newAddress) || isNormalAddress(newAddress))
throw ContractAddressCollision();
// Increment associated nonce for sender.
noteSending(_sender);
// All OK - set it up.
m_cache[newAddress] = AddressState(0, 0, AddressType::Contract);
auto& mem = m_cache[newAddress].memory();

Loading…
Cancel
Save