Speed up out of order transaction processing (RIPD-239):

* After successfully applying a transaction to the open ledger, resubmit any held transactions from the same account.
* All held transactions will continue to be retried after consensus round.
This commit is contained in:
Edward Hennis
2015-12-02 19:25:06 -05:00
committed by Nik Bougalis
parent 4d2e7ed404
commit 8be67c1766
5 changed files with 59 additions and 9 deletions

View File

@@ -19,6 +19,7 @@
#include <BeastConfig.h>
#include <ripple/app/misc/CanonicalTXSet.h>
#include <boost/range/adaptor/transformed.hpp>
namespace ripple {
@@ -96,6 +97,33 @@ void CanonicalTXSet::insert (std::shared_ptr<STTx const> const& txn)
txn));
}
std::vector<std::shared_ptr<STTx const>>
CanonicalTXSet::prune(AccountID const& account,
std::uint32_t const seq)
{
auto effectiveAccount = accountKey (account);
Key keyLow(effectiveAccount, seq, zero);
Key keyHigh(effectiveAccount, seq+1, zero);
auto range = boost::make_iterator_range(
mMap.lower_bound(keyLow),
mMap.lower_bound(keyHigh));
auto txRange = boost::adaptors::transform(
range,
[](auto const& p)
{
return p.second;
});
std::vector<std::shared_ptr<STTx const>> result(
txRange.begin(), txRange.end());
mMap.erase(range.begin(), range.end());
return result;
}
CanonicalTXSet::iterator CanonicalTXSet::erase (iterator const& it)
{
iterator tmp = it;