mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Improve held transaction submission:
Removed redundant validity checks for held transactions in NetworkOPsImp::apply.
This commit is contained in:
committed by
Vinnie Falco
parent
1c68fddad7
commit
72cdf3f555
@@ -920,6 +920,7 @@ void NetworkOPsImp::transactionBatch()
|
||||
|
||||
void NetworkOPsImp::apply (std::unique_lock<std::mutex>& batchLock)
|
||||
{
|
||||
std::vector<TransactionStatus> submit_held;
|
||||
std::vector<TransactionStatus> transactions;
|
||||
mTransactions.swap (transactions);
|
||||
assert (! transactions.empty());
|
||||
@@ -996,7 +997,13 @@ void NetworkOPsImp::apply (std::unique_lock<std::mutex>& batchLock)
|
||||
for (auto const& tx : m_ledgerMaster.pruneHeldTransactions(
|
||||
txCur->getAccountID(sfAccount), txCur->getSequence() + 1))
|
||||
{
|
||||
submitTransaction(tx);
|
||||
std::string reason;
|
||||
auto const trans = sterilize(*tx);
|
||||
auto t = std::make_shared<Transaction>(
|
||||
trans, reason, app_);
|
||||
submit_held.emplace_back(
|
||||
t, false, false, FailHard::no);
|
||||
t->setApplying();
|
||||
}
|
||||
}
|
||||
else if (e.result == tefPAST_SEQ)
|
||||
@@ -1075,6 +1082,15 @@ void NetworkOPsImp::apply (std::unique_lock<std::mutex>& batchLock)
|
||||
for (TransactionStatus& e : transactions)
|
||||
e.transaction->clearApplying();
|
||||
|
||||
if (! submit_held.empty())
|
||||
{
|
||||
if (mTransactions.empty())
|
||||
mTransactions.swap(submit_held);
|
||||
else
|
||||
for (auto& e : submit_held)
|
||||
mTransactions.push_back(std::move(e));
|
||||
}
|
||||
|
||||
mCond.notify_all();
|
||||
|
||||
mDispatchState = DispatchState::none;
|
||||
|
||||
Reference in New Issue
Block a user