Browse Source

Version bump push all valid "ready" transactions to the network asap.

cl-refactor
Gav Wood 10 years ago
parent
commit
b0dba6b559
  1. 2
      libdevcore/Common.cpp
  2. 7
      libethereum/BlockQueue.cpp
  3. 10
      libethereum/TransactionQueue.cpp
  4. 2
      libethereum/TransactionQueue.h

2
libdevcore/Common.cpp

@ -28,7 +28,7 @@ using namespace dev;
namespace dev
{
char const* Version = "0.9.21";
char const* Version = "0.9.22";
const u256 UndefinedU256 = ~(u256)0;

7
libethereum/BlockQueue.cpp

@ -62,12 +62,13 @@ void BlockQueue::verifierBody()
{
unique_lock<Mutex> l(m_verification);
m_moreToVerify.wait(l, [&](){ return !m_unverified.empty() || m_deleting; });
if (m_deleting)
return;
swap(work, m_unverified.front());
m_unverified.pop_front();
BlockInfo bi;
bi.mixHash = work.first;
m_verifying.push_back(make_pair(bi, bytes()));
cdebug << "Verifying" << bi.mixHash;
}
std::pair<BlockInfo, bytes> res;
@ -91,7 +92,6 @@ void BlockQueue::verifierBody()
for (auto it = m_verifying.begin(); it != m_verifying.end(); ++it)
if (it->first.mixHash == work.first)
{
cdebug << "Cancel verifying" << work.first;
m_verifying.erase(it);
goto OK1;
}
@ -106,12 +106,10 @@ void BlockQueue::verifierBody()
if (m_verifying.front().first.mixHash == work.first)
{
// we're next!
cdebug << "Verifyied" << work.first;
m_verifying.pop_front();
m_verified.push_back(move(res));
while (m_verifying.size() && !m_verifying.front().second.empty())
{
cdebug << "Pre-verified" << m_verifying.front().first.hash();
m_verified.push_back(move(m_verifying.front()));
m_verifying.pop_front();
}
@ -122,7 +120,6 @@ void BlockQueue::verifierBody()
for (auto& i: m_verifying)
if (i.first.mixHash == work.first)
{
cdebug << "Delay-verified" << work.first << " (replacing with " << res << ")";
i = move(res);
goto OK;
}

10
libethereum/TransactionQueue.cpp

@ -92,6 +92,16 @@ ImportResult TransactionQueue::import(Transaction const& _transaction, ImportCal
return ret;
}
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()))
ret.insert(i);
return ret;
}
ImportResult TransactionQueue::manageImport_WITH_LOCK(h256 const& _h, Transaction const& _transaction, ImportCallback const& _cb)
{
try

2
libethereum/TransactionQueue.h

@ -56,7 +56,7 @@ public:
void drop(h256 const& _txHash);
unsigned waiting(Address const& _a) const;
std::unordered_map<h256, Transaction> transactions() const { ReadGuard l(m_lock); return m_current; }
std::unordered_map<h256, Transaction> transactions() const;
std::pair<unsigned, unsigned> items() const { ReadGuard l(m_lock); return std::make_pair(m_current.size(), m_future.size()); }
u256 maxNonce(Address const& _a) const;

Loading…
Cancel
Save