Browse Source

Lockup fix.

cl-refactor
Gav Wood 10 years ago
parent
commit
3c410cf008
  1. 7
      libethereum/TransactionQueue.cpp
  2. 1
      libethereum/TransactionQueue.h
  3. 2
      libp2p/Host.cpp

7
libethereum/TransactionQueue.cpp

@ -97,7 +97,7 @@ std::unordered_map<h256, Transaction> TransactionQueue::transactions() const
ReadGuard l(m_lock);
auto ret = m_current;
for (auto const& i: m_future)
if (i.second.nonce() < maxNonce(i.second.sender()))
if (i.second.nonce() < maxNonce_WITH_LOCK(i.second.sender()))
ret.insert(i);
return ret;
}
@ -136,6 +136,11 @@ u256 TransactionQueue::maxNonce(Address const& _a) const
{
// cdebug << "txQ::maxNonce" << _a;
ReadGuard l(m_lock);
return maxNonce_WITH_LOCK(_a);
}
u256 TransactionQueue::maxNonce_WITH_LOCK(Address const& _a) const
{
u256 ret = 0;
auto r = m_senders.equal_range(_a);
for (auto it = r.first; it != r.second; ++it)

1
libethereum/TransactionQueue.h

@ -72,6 +72,7 @@ private:
void insertCurrent_WITH_LOCK(std::pair<h256, Transaction> const& _p);
bool remove_WITH_LOCK(h256 const& _txHash);
u256 maxNonce_WITH_LOCK(Address const& _a) const;
mutable SharedMutex m_lock; ///< General lock.
h256Hash m_known; ///< Hashes of transactions in both sets.

2
libp2p/Host.cpp

@ -392,7 +392,7 @@ string Host::pocHost()
std::unordered_map<Public, std::string> const& Host::pocHosts()
{
static const std::unordered_map<Public, std::string> c_ret = {
// { Public(""), "poc-9.ethdev.com:30303" },
{ Public("487611428e6c99a11a9795a6abe7b529e81315ca6aad66e2a2fc76e3adf263faba0d35466c2f8f68d561dbefa8878d4df5f1f2ddb1fbeab7f42ffb8cd328bd4a"), "poc-9.ethdev.com:30303" },
{ Public("a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c"), "52.16.188.185:30303" },
{ Public("7f25d3eab333a6b98a8b5ed68d962bb22c876ffcd5561fca54e3c2ef27f754df6f7fd7c9b74cc919067abac154fb8e1f8385505954f161ae440abc355855e034"), "54.207.93.166:30303" }
};

Loading…
Cancel
Save