Browse Source

Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop

cl-refactor
Gav Wood 11 years ago
parent
commit
e572a11f2d
  1. 2
      libethereum/BlockChain.cpp
  2. 4
      libethereum/Client.h
  3. 2
      libethereum/PeerServer.cpp
  4. 2
      libethereum/PeerServer.h
  5. 28
      neth/main.cpp
  6. 6
      windows/LibEthereum.vcxproj
  7. 18
      windows/LibEthereum.vcxproj.filters
  8. 1
      windows/LibQEthereum.props
  9. 19
      windows/LibQEthereum.vcxproj
  10. 2
      windows/LibQEthereum.vcxproj.filters

2
libethereum/BlockChain.cpp

@ -170,6 +170,7 @@ h256s BlockChain::sync(BlockQueue& _bq, OverlayDB const& _stateDB, unsigned _max
h256s ret;
for (auto const& block: blocks)
{
try
{
for (auto h: import(block, _stateDB))
@ -184,6 +185,7 @@ h256s BlockChain::sync(BlockQueue& _bq, OverlayDB const& _stateDB, unsigned _max
_bq.import(&block, *this);
}
catch (...){}
}
return ret;
}

4
libethereum/Client.h

@ -221,8 +221,8 @@ public:
unsigned installWatch(TransactionFilter const& _filter);
unsigned installWatch(h256 _filterId);
void uninstallWatch(unsigned _watchId);
bool peekWatch(unsigned _watchId) const { std::lock_guard<std::mutex> l(m_filterLock); try { return m_watches.at(_watchId).changes; } catch (...) { return 0; } }
bool checkWatch(unsigned _watchId) { std::lock_guard<std::mutex> l(m_filterLock); bool ret = false; try { ret = m_watches.at(_watchId).changes; m_watches.at(_watchId).changes = 0; } catch (...) {} return ret; }
bool peekWatch(unsigned _watchId) const { std::lock_guard<std::mutex> l(m_filterLock); try { return m_watches.at(_watchId).changes != 0; } catch (...) { return false; } }
bool checkWatch(unsigned _watchId) { std::lock_guard<std::mutex> l(m_filterLock); bool ret = false; try { ret = m_watches.at(_watchId).changes != 0; m_watches.at(_watchId).changes = 0; } catch (...) {} return ret; }
// [EXTRA API]:

2
libethereum/PeerServer.cpp

@ -132,7 +132,7 @@ void PeerServer::disconnectPeers()
if (!n)
break;
m_ioService.poll();
usleep(100000);
this_thread::sleep_for(chrono::milliseconds(100));
}
delete m_upnp;

2
libethereum/PeerServer.h

@ -77,7 +77,7 @@ public:
/// This won't touch alter the blockchain.
void process() { if (isInitialised()) m_ioService.poll(); }
bool havePeer(Public _id) const { Guard l(x_peers); return m_peers.count(_id); }
bool havePeer(Public _id) const { Guard l(x_peers); return m_peers.count(_id) != 0; }
/// Set ideal number of peers.
void setIdealPeerCount(unsigned _n) { m_idealPeerCount = _n; }

28
neth/main.cpp

@ -889,23 +889,21 @@ int main(int argc, char** argv)
// Pending
y = 1;
auto aps = c.pending();
for (auto const& t: aps)
for (Transaction const& t: c.pending())
{
if (t.receiveAddress)
auto s = boost::format("%1% %2%> %3%: %4% [%5%]") %
auto s = t.receiveAddress ?
boost::format("%1% %2%> %3%: %4% [%5%]") %
toString(t.safeSender()) %
(st.addressHasCode(t.receiveAddress) ? '*' : '-') %
toString(t.receiveAddress) %
toString(formatBalance(t.value)) %
toString((unsigned)t.nonce);
else
auto s = boost::format("%1% +> %2%: %3% [%4%]") %
toString((unsigned)t.nonce) :
boost::format("%1% +> %2%: %3% [%4%]") %
toString(t.safeSender()) %
toString(right160(sha3(rlpList(t.safeSender(), t.nonce)))) %
toString(formatBalance(t.value)) %
toString((unsigned)t.nonce);
mvwaddnstr(pendingwin, y++, x, s.c_str(), qwidth);
mvwaddnstr(pendingwin, y++, x, s.str().c_str(), qwidth);
if (y > height * 1 / 5 - 4)
break;
}
@ -948,14 +946,14 @@ int main(int argc, char** argv)
// Peers
y = 1;
string psc;
string pss;
auto cp = c.peers();
psc = toString(cp.size()) + " peer(s)";
for (PeerInfo const& i: cp)
for (PeerInfo const& i: c.peers())
{
pss = toString(chrono::duration_cast<chrono::milliseconds>(i.lastPing).count()) + " ms - " + i.host + ":" + toString(i.port) + " - " + i.clientVersion;
mvwaddnstr(peerswin, y++, x, pss.c_str(), qwidth);
auto s = boost::format("%1% ms - %2%:%3% - %4%") %
toString(chrono::duration_cast<chrono::milliseconds>(i.lastPing).count()) %
i.host %
toString(i.port) %
i.clientVersion;
mvwaddnstr(peerswin, y++, x, s.str().c_str(), qwidth);
if (y > height * 2 / 5 - 4)
break;
}

6
windows/LibEthereum.vcxproj

@ -42,10 +42,13 @@
<ClCompile Include="..\libethential\RLP.cpp" />
<ClCompile Include="..\libethereum\AddressState.cpp" />
<ClCompile Include="..\libethereum\BlockChain.cpp" />
<ClCompile Include="..\libethereum\BlockDetails.cpp" />
<ClCompile Include="..\libethereum\BlockQueue.cpp" />
<ClCompile Include="..\libethereum\Client.cpp" />
<ClCompile Include="..\libethereum\Defaults.cpp" />
<ClCompile Include="..\libethereum\Executive.cpp" />
<ClCompile Include="..\libethereum\ExtVM.cpp" />
<ClCompile Include="..\libethereum\Manifest.cpp" />
<ClCompile Include="..\libethereum\PeerNetwork.cpp" />
<ClCompile Include="..\libethereum\PeerServer.cpp" />
<ClCompile Include="..\libethereum\PeerSession.cpp" />
@ -94,10 +97,13 @@
<ClInclude Include="..\libethential\vector_ref.h" />
<ClInclude Include="..\libethereum\AddressState.h" />
<ClInclude Include="..\libethereum\BlockChain.h" />
<ClInclude Include="..\libethereum\BlockDetails.h" />
<ClInclude Include="..\libethereum\BlockQueue.h" />
<ClInclude Include="..\libethereum\Client.h" />
<ClInclude Include="..\libethereum\Defaults.h" />
<ClInclude Include="..\libethereum\Executive.h" />
<ClInclude Include="..\libethereum\ExtVM.h" />
<ClInclude Include="..\libethereum\Manifest.h" />
<ClInclude Include="..\libethereum\PeerNetwork.h" />
<ClInclude Include="..\libethereum\PeerServer.h" />
<ClInclude Include="..\libethereum\PeerSession.h" />

18
windows/LibEthereum.vcxproj.filters

@ -115,6 +115,15 @@
<ClCompile Include="..\liblll\Parser.cpp">
<Filter>liblll</Filter>
</ClCompile>
<ClCompile Include="..\libethereum\BlockDetails.cpp">
<Filter>libethereum</Filter>
</ClCompile>
<ClCompile Include="..\libethereum\BlockQueue.cpp">
<Filter>libethereum</Filter>
</ClCompile>
<ClCompile Include="..\libethereum\Manifest.cpp">
<Filter>libethereum</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@ -258,6 +267,15 @@
<ClInclude Include="..\liblll\Parser.h">
<Filter>liblll</Filter>
</ClInclude>
<ClInclude Include="..\libethereum\BlockDetails.h">
<Filter>libethereum</Filter>
</ClInclude>
<ClInclude Include="..\libethereum\BlockQueue.h">
<Filter>libethereum</Filter>
</ClInclude>
<ClInclude Include="..\libethereum\Manifest.h">
<Filter>libethereum</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Windows">

1
windows/LibQEthereum.props

@ -17,6 +17,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..;$(QtInclude);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4718;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PreprocessorDefinitions>ETH_QTQML=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link />
<PreBuildEvent>

19
windows/LibQEthereum.vcxproj

@ -25,6 +25,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\libqethereum\QEthereum.cpp" />
<ClCompile Include="..\libqethereum\QmlEthereum.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
@ -53,6 +54,24 @@
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\libqethereum\QmlEthereum.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Lua) moc.lua "$(QtBin)/moc" "$(IntDir)moc_%(FileName).cpp" "@(ClCompile->'%(AdditionalIncludeDirectories)');$(IncludePath)" "@(ClCompile->'%(PreprocessorDefinitions)');_MSC_VER=1800" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Lua) moc.lua "$(QtBin)/moc" "$(IntDir)moc_%(FileName).cpp" "@(ClCompile->'%(AdditionalIncludeDirectories)');$(IncludePath)" "@(ClCompile->'%(PreprocessorDefinitions)');_MSC_VER=1800" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Lua) moc.lua "$(QtBin)/moc" "$(IntDir)moc_%(FileName).cpp" "@(ClCompile->'%(AdditionalIncludeDirectories)');$(IncludePath)" "@(ClCompile->'%(PreprocessorDefinitions)');_MSC_VER=1800" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Lua) moc.lua "$(QtBin)/moc" "$(IntDir)moc_%(FileName).cpp" "@(ClCompile->'%(AdditionalIncludeDirectories)');$(IncludePath)" "@(ClCompile->'%(PreprocessorDefinitions)');_MSC_VER=1800" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)moc_%(FileName).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)moc_%(FileName).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)moc_%(FileName).cpp</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)moc_%(FileName).cpp</Outputs>
</CustomBuild>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<PropertyGroup Label="Globals">

2
windows/LibQEthereum.vcxproj.filters

@ -10,11 +10,13 @@
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\libqethereum\QEthereum.cpp" />
<ClCompile Include="..\libqethereum\QmlEthereum.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Windows</Filter>
</ClInclude>
<ClInclude Include="..\libqethereum\QmlEthereum.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\libqethereum\QEthereum.h" />

Loading…
Cancel
Save