Browse Source

Final transaction stuff in JS-API and bug fixes.

cl-refactor
Gav Wood 11 years ago
parent
commit
3e87c79c87
  1. 3
      alethzero/MainWin.cpp
  2. 1
      libethereum/AddressState.h
  3. 3
      libethereum/Executive.cpp
  4. 2
      libethereum/State.cpp
  5. 2
      libethereum/Transaction.h

3
alethzero/MainWin.cpp

@ -977,9 +977,12 @@ void Main::initDebugger()
dc->clear();
if (m_currentExecution)
{
for (unsigned i = 0; i < m_currentExecution->ext().code.size(); ++i)
cnote << i << std::hex << (int)m_currentExecution->ext().code[i];
for (unsigned i = 0; i <= m_currentExecution->ext().code.size(); ++i)
{
byte b = i < m_currentExecution->ext().code.size() ? m_currentExecution->ext().code[i] : 0;
cnote << i << std::hex << (int)b;
QString s = c_instructionInfo.at((Instruction)b).name;
m_pcWarp[i] = dc->count();
ostringstream out;

1
libethereum/AddressState.h

@ -52,6 +52,7 @@ public:
bool isFreshCode() const { return !m_codeHash; }
h256 codeHash() const { assert(m_codeHash); return m_codeHash; }
bool haveCode() const { return m_codeHash == EmptySHA3 || !m_codeHash || m_codeCache.size(); }
bytes const& code() const { assert(m_codeHash == EmptySHA3 || !m_codeHash || m_codeCache.size()); return m_codeCache; }
void setCode(bytesConstRef _code) { assert(!m_codeHash); m_codeCache = _code.toBytes(); }
void noteCode(bytesConstRef _code) { assert(sha3(_code) == m_codeHash); m_codeCache = _code.toBytes(); }

3
libethereum/Executive.cpp

@ -99,7 +99,8 @@ void Executive::call(Address _receiveAddress, Address _senderAddress, u256 _valu
if (m_s.addressHasCode(_receiveAddress))
{
m_vm = new VM(_gas);
m_ext = new ExtVM(m_s, _receiveAddress, _senderAddress, _originAddress, _value, _gasPrice, _data, &m_s.code(_receiveAddress));
bytes const& c = m_s.code(_receiveAddress);
m_ext = new ExtVM(m_s, _receiveAddress, _senderAddress, _originAddress, _value, _gasPrice, _data, &c);
}
else
m_endGas = _gas;

2
libethereum/State.cpp

@ -141,7 +141,7 @@ void State::ensureCached(std::map<Address, AddressState>& _cache, Address _a, bo
bool ok;
tie(it, ok) = _cache.insert(make_pair(_a, s));
}
if (_requireCode && it != _cache.end() && !it->second.isFreshCode())
if (_requireCode && it != _cache.end() && !it->second.isFreshCode() && !it->second.haveCode())
it->second.noteCode(it->second.codeHash() == EmptySHA3 ? bytesConstRef() : bytesConstRef(m_db.lookup(it->second.codeHash())));
}

2
libethereum/Transaction.h

@ -88,7 +88,7 @@ inline std::ostream& operator<<(std::ostream& _out, Transaction const& _t)
_out << "<-" << _t.sender().abridged();
}
catch (...) {}
_out << "}";
_out << " #" << _t.data.size() << "}";
return _out;
}

Loading…
Cancel
Save