mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Multiple transactions per account in TxQ (RIPD-1048):
* Tweak account XRP balance and sequence if needed before preclaim. * Limit total fees in flight to minimum reserve / account balance. * LastLedgerSequence must be at least 2 more than the current ledger to be queued. * Limit 10 transactions per account in the queue at a time. * Limit queuing multiple transactions after transactions that affect authentication. * Zero base fee transactions are treated as having a fixed fee level of 256000 instead of infinite. * Full queue: new txn can only kick out a tx if the fee is higher than that account's average fee. * Queued tx retry limit prevents indefinitely stuck txns. * Return escalation factors in server_info and _state when escalated. * Update documentation. * Update experimental config to only include the % increase. * Convert TxQ metric magic numbers to experimental config.
This commit is contained in:
committed by
Vinnie Falco
parent
7f97b7bc05
commit
2e2a7509cd
@@ -156,6 +156,47 @@ invoke_calculateBaseFee(PreclaimContext const& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static
|
||||
TxConsequences
|
||||
invoke_calculateConsequences(STTx const& tx)
|
||||
{
|
||||
auto const category = T::affectsSubsequentTransactionAuth(tx) ?
|
||||
TxConsequences::blocker : TxConsequences::normal;
|
||||
auto const feePaid = T::calculateFeePaid(tx);
|
||||
auto const maxSpend = T::calculateMaxSpend(tx);
|
||||
|
||||
return{ category, feePaid, maxSpend };
|
||||
}
|
||||
|
||||
static
|
||||
TxConsequences
|
||||
invoke_calculateConsequences(STTx const& tx)
|
||||
{
|
||||
switch (tx.getTxnType())
|
||||
{
|
||||
case ttACCOUNT_SET: return invoke_calculateConsequences<SetAccount>(tx);
|
||||
case ttOFFER_CANCEL: return invoke_calculateConsequences<CancelOffer>(tx);
|
||||
case ttOFFER_CREATE: return invoke_calculateConsequences<CreateOffer>(tx);
|
||||
case ttPAYMENT: return invoke_calculateConsequences<Payment>(tx);
|
||||
case ttSUSPAY_CREATE: return invoke_calculateConsequences<SusPayCreate>(tx);
|
||||
case ttSUSPAY_FINISH: return invoke_calculateConsequences<SusPayFinish>(tx);
|
||||
case ttSUSPAY_CANCEL: return invoke_calculateConsequences<SusPayCancel>(tx);
|
||||
case ttREGULAR_KEY_SET: return invoke_calculateConsequences<SetRegularKey>(tx);
|
||||
case ttSIGNER_LIST_SET: return invoke_calculateConsequences<SetSignerList>(tx);
|
||||
case ttTICKET_CANCEL: return invoke_calculateConsequences<CancelTicket>(tx);
|
||||
case ttTICKET_CREATE: return invoke_calculateConsequences<CreateTicket>(tx);
|
||||
case ttTRUST_SET: return invoke_calculateConsequences<SetTrust>(tx);
|
||||
case ttAMENDMENT:
|
||||
case ttFEE:
|
||||
// fall through to default
|
||||
default:
|
||||
assert(false);
|
||||
return { TxConsequences::blocker, Transactor::calculateFeePaid(tx),
|
||||
beast::zero };
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
std::pair<TER, bool>
|
||||
invoke_apply (ApplyContext& ctx)
|
||||
@@ -245,6 +286,17 @@ calculateBaseFee(Application& app, ReadView const& view,
|
||||
return invoke_calculateBaseFee(ctx);
|
||||
}
|
||||
|
||||
TxConsequences
|
||||
calculateConsequences(PreflightResult const& preflightResult)
|
||||
{
|
||||
assert(preflightResult.ter == tesSUCCESS);
|
||||
if (preflightResult.ter != tesSUCCESS)
|
||||
return{ TxConsequences::blocker,
|
||||
Transactor::calculateFeePaid(preflightResult.tx),
|
||||
beast::zero };
|
||||
return invoke_calculateConsequences(preflightResult.tx);
|
||||
}
|
||||
|
||||
std::pair<TER, bool>
|
||||
doApply(PreclaimResult const& preclaimResult,
|
||||
Application& app, OpenView& view)
|
||||
|
||||
Reference in New Issue
Block a user