Browse Source

More fixing for genesis block info.

cl-refactor
Gav Wood 10 years ago
parent
commit
86b309d1f0
  1. 4
      alethzero/MainWin.cpp
  2. 3
      libethcore/BlockInfo.cpp
  3. 2
      libethereum/BlockChain.cpp
  4. 2
      libethereum/State.cpp

4
alethzero/MainWin.cpp

@ -107,10 +107,10 @@ Main::Main(QWidget *parent) :
m_servers.append(QString::fromStdString(Host::pocHost() + ":30303")); m_servers.append(QString::fromStdString(Host::pocHost() + ":30303"));
cerr << "State root: " << BlockChain::genesis().stateRoot << endl; cerr << "State root: " << BlockChain::genesis().stateRoot << endl;
cerr << "Block Hash: " << sha3(BlockChain::createGenesisBlock()) << endl;
auto block = BlockChain::createGenesisBlock(); auto block = BlockChain::createGenesisBlock();
cerr << "Block Hash: " << BlockChain::genesis().hash << endl;
cerr << "Block RLP: " << RLP(block) << endl; cerr << "Block RLP: " << RLP(block) << endl;
cerr << "Block Hex: " << toHex(BlockChain::createGenesisBlock()) << endl; cerr << "Block Hex: " << toHex(block) << endl;
cerr << "Network protocol version: " << dev::eth::c_protocolVersion << endl; cerr << "Network protocol version: " << dev::eth::c_protocolVersion << endl;
cerr << "Client database version: " << dev::eth::c_databaseVersion << endl; cerr << "Client database version: " << dev::eth::c_databaseVersion << endl;

3
libethcore/BlockInfo.cpp

@ -61,7 +61,8 @@ auto static const s_sha3EmptyList = sha3(RLPEmptyList);
void BlockInfo::fillStream(RLPStream& _s, bool _nonce) const void BlockInfo::fillStream(RLPStream& _s, bool _nonce) const
{ {
_s.appendList(_nonce ? 13 : 12) << parentHash; _s.appendList(_nonce ? 13 : 12) << parentHash;
_s.append(sha3Uncles == s_sha3EmptyList ? h256() : sha3Uncles, false, true) << coinbaseAddress; _s.append(sha3Uncles == s_sha3EmptyList ? h256() : sha3Uncles, false, true);
_s << coinbaseAddress;
_s.append(stateRoot, false, true).append(transactionsRoot, false, true); _s.append(stateRoot, false, true).append(transactionsRoot, false, true);
_s << difficulty << number << minGasPrice << gasLimit << gasUsed << timestamp << extraData; _s << difficulty << number << minGasPrice << gasLimit << gasUsed << timestamp << extraData;
if (_nonce) if (_nonce)

2
libethereum/BlockChain.cpp

@ -101,7 +101,7 @@ bytes BlockChain::createGenesisBlock()
stateRoot = state.root(); stateRoot = state.root();
} }
block.appendList(13) << h256() << h256() << h160(); block.appendList(13) << h256() << bytes() << h160();
block.append(stateRoot, false, true) << bytes() << c_genesisDifficulty << 0 << 0 << 1000000 << 0 << (unsigned)0 << string() << sha3(bytes(1, 42)); block.append(stateRoot, false, true) << bytes() << c_genesisDifficulty << 0 << 0 << 1000000 << 0 << (unsigned)0 << string() << sha3(bytes(1, 42));
block.appendRaw(RLPEmptyList); block.appendRaw(RLPEmptyList);
block.appendRaw(RLPEmptyList); block.appendRaw(RLPEmptyList);

2
libethereum/State.cpp

@ -826,7 +826,7 @@ void State::commitToMine(BlockChain const& _bc)
RLPStream(unclesCount).appendRaw(unclesData.out(), unclesCount).swapOut(m_currentUncles); RLPStream(unclesCount).appendRaw(unclesData.out(), unclesCount).swapOut(m_currentUncles);
m_currentBlock.transactionsRoot = transactionReceipts.root(); m_currentBlock.transactionsRoot = transactionReceipts.root();
m_currentBlock.sha3Uncles = unclesCount ? sha3(m_currentUncles) : h256(); m_currentBlock.sha3Uncles = sha3(m_currentUncles);
// Apply rewards last of all. // Apply rewards last of all.
applyRewards(uncleAddresses); applyRewards(uncleAddresses);

Loading…
Cancel
Save