Browse Source

Null-account/address PoC-6 updates.

cl-refactor
Gav Wood 10 years ago
parent
commit
e067be15e0
  1. 2
      libethereum/State.cpp
  2. 6
      libethereum/State.h
  3. 9
      libethereum/Transaction.cpp

2
libethereum/State.cpp

@ -287,7 +287,7 @@ void State::ensureCached(std::map<Address, AddressState>& _cache, Address _a, bo
if (state.isNull())
s = AddressState(0, 0, h256(), EmptySHA3);
else
s = AddressState(state[0].toInt<u256>(), state[1].toInt<u256>(), state[2].toHash<h256>(), state[3].toHash<h256>());
s = AddressState(state[0].toInt<u256>(), state[1].toInt<u256>(), state[2].toHash<h256>(), state[3].isEmpty() ? EmptySHA3 : state[3].toHash<h256>());
bool ok;
tie(it, ok) = _cache.insert(make_pair(_a, s));
}

6
libethereum/State.h

@ -386,8 +386,14 @@ void commit(std::map<Address, AddressState> const& _cache, DB& _db, TrieDB<Addre
{
h256 ch = sha3(i.second.code());
_db.insert(ch, &i.second.code());
if (i.second.code().size())
s << ch;
else
s << "";
}
else
if (i.second.codeHash() == EmptySHA3)
s << "";
else
s << i.second.codeHash();

9
libethereum/Transaction.cpp

@ -38,7 +38,7 @@ Transaction::Transaction(bytesConstRef _rlpData, bool _checkSender)
nonce = rlp[field = 0].toInt<u256>();
gasPrice = rlp[field = 1].toInt<u256>();
gas = rlp[field = 2].toInt<u256>();
receiveAddress = rlp[field = 3].toHash<Address>();
receiveAddress = rlp[field = 3].isEmpty() ? Address() : Address();
value = rlp[field = 4].toInt<u256>();
data = rlp[field = 5].toBytes();
vrs = Signature{ rlp[field = 6].toInt<byte>(), rlp[field = 7].toInt<u256>(), rlp[field = 8].toInt<u256>() };
@ -119,7 +119,12 @@ void Transaction::sign(Secret _priv)
void Transaction::fillStream(RLPStream& _s, bool _sig) const
{
_s.appendList((_sig ? 3 : 0) + 6);
_s << nonce << gasPrice << gas << receiveAddress << value << data;
_s << nonce << gasPrice << gas;
if (receiveAddress)
_s << receiveAddress;
else
_s << "";
_s << value << data;
if (_sig)
_s << vrs.v << vrs.r << vrs.s;
}

Loading…
Cancel
Save