Browse Source

Merge pull request #14 from subtly/master

Compiler/C++11 bug building on macos (Mavericks)
cl-refactor
Gav Wood 11 years ago
parent
commit
0a87491a75
  1. 21
      libethereum/State.cpp

21
libethereum/State.cpp

@ -103,7 +103,10 @@ void State::ensureCached(Address _a, bool _requireMemory, bool _forceCreate) con
TrieDB<u256, Overlay> memdb(const_cast<Overlay*>(&m_db), it->second.oldRoot()); // promise we won't alter the overlay! :)
map<u256, u256>& mem = it->second.takeMemory();
for (auto const& i: memdb)
mem[i.first] = RLP(i.second).toInt<u256>();
if(mem.find(i.first)==mem.end())
mem.insert(std::pair<u256,u256>(i.first,RLP(i.second).toInt<u256>()));
else
mem.at(i.first) = RLP(i.second).toInt<u256>();
}
}
@ -565,7 +568,11 @@ void State::executeBare(Transaction const& _t, Address _sender)
m_cache[newAddress] = AddressState(0, 0, sha3(RLPNull));
auto& mem = m_cache[newAddress].takeMemory();
for (uint i = 0; i < _t.data.size(); ++i)
mem[i] = _t.data[i];
if(mem.find(i)==mem.end())
mem.insert(std::pair<u256,u256>(i,_t.data[i]));
else
mem.at(i) = _t.data[i];
subBalance(_sender, _t.value + _t.fee);
addBalance(newAddress, _t.value);
addBalance(m_currentBlock.coinbaseAddress, _t.fee);
@ -600,10 +607,14 @@ void State::execute(Address _myAddress, Address _txSender, u256 _txValue, u256 _
};
auto setMem = [&](u256 _n, u256 _v)
{
if (_v)
myMemory[_n] = _v;
else
if (_v) {
if(myMemory.find(_n)==myMemory.end())
myMemory.insert(std::pair<u256,u256>(_n,_v));
else
myMemory.at(_n) = _v;
} else {
myMemory.erase(_n);
}
};
u256 curPC = 0;

Loading…
Cancel
Save