Browse Source

Merge ../../cpp-ethereum

cl-refactor
Gav Wood 11 years ago
parent
commit
0a5a55d730
  1. 19
      alephzero/Main.ui
  2. 2
      alephzero/MainWin.cpp
  3. 11
      alephzero/alephzero.pro
  4. 2
      libethereum/BlockInfo.cpp
  5. 16
      libethereum/PeerNetwork.cpp
  6. 6
      libethereum/State.cpp

19
alephzero/Main.ui

@ -29,6 +29,25 @@
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="upnp">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>UPnP</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="net">
<property name="text">

2
alephzero/MainWin.cpp

@ -166,7 +166,7 @@ void Main::refresh()
void Main::on_net_toggled()
{
if (ui->net->isChecked())
m_client.startNetwork(ui->port->value(), string(), 30303, 6);
m_client.startNetwork(ui->port->value(), string(), 30303, 6, NodeMode::Full, 5, std::string(), ui->upnp->isChecked());
else
m_client.stopNetwork();
}

11
alephzero/alephzero.pro

@ -18,14 +18,17 @@ QMAKE_CXXFLAGS += -std=c++11
local_cryptopp {
QMAKE_LIBDIR += ../../cryptopp562
INCLUDE_PATH += ../libethereum
LIBS += -lcryptoppeth
CRYPTOPP_LIBS += -lcryptopp
}
!local_cryptopp {
CRYPTOPP_LIBS += -lcryptoppeth
}
INCLUDEPATH += ../../cpp-ethereum
QMAKE_LIBDIR += ../../cpp-ethereum-build/libethereum
QMAKE_LIBDIR += ../../cpp-ethereum-build/libethereum ../../cpp-ethereum-build/secp256k1
CONFIG(debug, debug|release): LIBS += -Wl,-rpath,../../cpp-ethereum-build/libethereum
LIBS += -lethereum -lminiupnpc -lleveldb -lgmp -lboost_filesystem -lboost_system
LIBS += -lethereum $${CRYPTOPP_LIBS} -lsecp256k1 -lminiupnpc -lleveldb -lgmp -lboost_filesystem -lboost_system
SOURCES += main.cpp \
MainWin.cpp

2
libethereum/BlockInfo.cpp

@ -56,7 +56,7 @@ bytes BlockInfo::createGenesisBlock()
clog << db;
}
block.appendList(9) << h256() << sha3EmptyList << h160() << stateRoot << sha3EmptyList << c_genesisDifficulty << (uint)0 << string() << (uint)0;
block.appendList(9) << h256() << sha3EmptyList << h160() << stateRoot << sha3EmptyList << c_genesisDifficulty << (uint)0 << string() << (uint)42;
block.appendRaw(RLPEmptyList);
block.appendRaw(RLPEmptyList);
return block.out();

16
libethereum/PeerNetwork.cpp

@ -599,8 +599,10 @@ struct UPnP
string externalIP()
{
char addr[16];
UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, addr);
if (!UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, addr))
return addr;
else
return "0.0.0.0";
}
int addRedirect(char const* addr, int port)
@ -742,7 +744,8 @@ void PeerServer::determinePublic(string const& _publicAddress, bool _upnp)
p = m_listenPort;
}
if (m_upnp->externalIP() == string("0.0.0.0") && _publicAddress.empty())
auto eip = m_upnp->externalIP();
if (eip == string("0.0.0.0") && _publicAddress.empty())
m_public = bi::tcp::endpoint(bi::address(), p);
else
{
@ -762,15 +765,6 @@ void PeerServer::determinePublic(string const& _publicAddress, bool _upnp)
m_public = bi::tcp::endpoint(bi::address(), m_listenPort);
m_addresses.push_back(m_public.address().to_v4());
}
/* int er;
UPNPDev* dlist = upnpDiscover(250, 0, 0, 0, 0, &er);
for (UPNPDev* d = dlist; d; d = dlist->pNext)
{
IGDdatas data;
parserootdesc(d->descURL, 0, &data);
data.presentationurl()
}
freeUPNPDevlist(dlist);*/
}
void PeerServer::populateAddresses()

6
libethereum/State.cpp

@ -67,6 +67,7 @@ std::map<Address, AddressState> const& eth::genesisState()
// Initialise.
s_ret[Address(fromUserHex("812413ae7e515a3bcaf7b3444116527bce958c02"))] = AddressState(u256(1) << 200, 0);
s_ret[Address(fromUserHex("93658b04240e4bd4046fd2d6d417d20f146f4b43"))] = AddressState(u256(1) << 200, 0);
s_ret[Address(fromUserHex("1e12515ce3e0f817a4ddef9ca55788a1d66bd2df"))] = AddressState(u256(1) << 200, 0);
}
return s_ret;
}
@ -96,12 +97,13 @@ State::State(Address _coinbaseAddress, Overlay const& _db): m_db(_db), m_state(&
cout << "State::State: state root initialised to " << m_state.root() << endl;
m_previousBlock = BlockInfo::genesis();
cnote << "Genesis headerhash-nononce:" << m_previousBlock.headerHashWithoutNonce();
cnote << "Genesis hash:" << m_previousBlock.hash;
{
RLPStream s;
m_previousBlock.fillStream(s, false);
m_previousBlock.fillStream(s, true);
cnote << RLP(s.out());
cnote << asHex(s.out());
cnote << sha3(s.out());
}
resetCurrent();

Loading…
Cancel
Save