Browse Source

Merge branch 'develop' into mk_jsonrpc

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
70447d1b5d
  1. 4
      alethzero/MainWin.cpp
  2. 11
      libethcore/BlockInfo.cpp
  3. 2
      libethcore/CommonEth.cpp
  4. 3
      libethereum/BlockChain.cpp
  5. 4
      libp2p/Host.cpp
  6. 2
      stdserv.js

4
alethzero/MainWin.cpp

@ -107,10 +107,10 @@ Main::Main(QWidget *parent) :
m_servers.append(QString::fromStdString(Host::pocHost() + ":30303"));
cerr << "State root: " << BlockChain::genesis().stateRoot << endl;
cerr << "Block Hash: " << sha3(BlockChain::createGenesisBlock()) << endl;
auto block = BlockChain::createGenesisBlock();
cerr << "Block Hash: " << BlockChain::genesis().hash << 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 << "Client database version: " << dev::eth::c_databaseVersion << endl;

11
libethcore/BlockInfo.cpp

@ -56,9 +56,13 @@ h256 BlockInfo::headerHashWithoutNonce() const
return sha3(s.out());
}
auto static const c_sha3EmptyList = sha3(RLPEmptyList);
void BlockInfo::fillStream(RLPStream& _s, bool _nonce) const
{
_s.appendList(_nonce ? 13 : 12) << parentHash << sha3Uncles << coinbaseAddress;
_s.appendList(_nonce ? 13 : 12) << parentHash;
_s.append(sha3Uncles == c_sha3EmptyList ? h256() : sha3Uncles, false, true);
_s << coinbaseAddress;
_s.append(stateRoot, false, true).append(transactionsRoot, false, true);
_s << difficulty << number << minGasPrice << gasLimit << gasUsed << timestamp << extraData;
if (_nonce)
@ -79,6 +83,8 @@ void BlockInfo::populateFromHeader(RLP const& _header, bool _checkNonce)
{
parentHash = _header[field = 0].toHash<h256>();
sha3Uncles = _header[field = 1].toHash<h256>();
if (sha3Uncles == h256())
sha3Uncles = c_sha3EmptyList;
coinbaseAddress = _header[field = 2].toHash<Address>();
stateRoot = _header[field = 3].toHash<h256>();
transactionsRoot = _header[field = 4].toHash<h256>();
@ -179,8 +185,7 @@ u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const
}
void BlockInfo::verifyParent(BlockInfo const& _parent) const
{
// Check difficulty is correct given the two timestamps.
{ // Check difficulty is correct given the two timestamps.
if (difficulty != calculateDifficulty(_parent))
BOOST_THROW_EXCEPTION(InvalidDifficulty());

2
libethcore/CommonEth.cpp

@ -34,7 +34,7 @@ namespace dev
namespace eth
{
const unsigned c_protocolVersion = 35;
const unsigned c_protocolVersion = 36;
const unsigned c_databaseVersion = 3;
static const vector<pair<u256, string>> g_units =

3
libethereum/BlockChain.cpp

@ -91,7 +91,6 @@ ldb::Slice dev::eth::toSlice(h256 _h, unsigned _sub)
bytes BlockChain::createGenesisBlock()
{
RLPStream block(3);
auto sha3EmptyList = sha3(RLPEmptyList);
h256 stateRoot;
{
@ -102,7 +101,7 @@ bytes BlockChain::createGenesisBlock()
stateRoot = state.root();
}
block.appendList(13) << h256() << sha3EmptyList << 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.appendRaw(RLPEmptyList);
block.appendRaw(RLPEmptyList);

4
libp2p/Host.cpp

@ -375,7 +375,7 @@ shared_ptr<Node> Host::noteNode(NodeId _id, bi::tcp::endpoint _a, Origin _o, boo
_a = bi::tcp::endpoint(_a.address(), 0);
}
cnote << "Node:" << _id.abridged() << _a << (_ready ? "ready" : "used") << _oldId.abridged() << (m_nodes.count(_id) ? "[have]" : "[NEW]");
// cnote << "Node:" << _id.abridged() << _a << (_ready ? "ready" : "used") << _oldId.abridged() << (m_nodes.count(_id) ? "[have]" : "[NEW]");
// First check for another node with the same connection credentials, and put it in oldId if found.
if (!_oldId)
@ -422,7 +422,7 @@ shared_ptr<Node> Host::noteNode(NodeId _id, bi::tcp::endpoint _a, Origin _o, boo
else
m_private -= i;
cnote << m_nodes[_id]->index << ":" << m_ready;
// cnote << m_nodes[_id]->index << ":" << m_ready;
m_hadNewNodes = true;

2
stdserv.js

@ -280,7 +280,7 @@ env.note('Register my name...')
eth.transact({ 'to': nameReg, 'data': [ eth.fromAscii('register'), eth.fromAscii('Gav') ] });
env.note('Dole out ETH to other address...')
eth.transact({ 'value': '100000000000000000000', 'to': eth.secretToAddress(eth.keys[1]) });
eth.transact({ 'value': '100000000000000000000', 'to': eth.accounts[1] });
env.note('Register my other name...')
eth.transact({ 'from': eth.keys[1], 'to': nameReg, 'data': [ eth.fromAscii('register'), eth.fromAscii("Gav Would") ] });

Loading…
Cancel
Save