Tx queue enhancements and RPC info (RIPD-1205, RIPD-1206):

* Account-related queue stats (RIPD-1205). Boolean "queue" parameter to
  account_info only if requesting the open ledger.
* Account for the TxQ when autofilling sequence in sign-and-submit (RIPD-1206)
* Tweak TxQ::accept edge case when choosing which tx to try next.
* Labels for experimental "x_" submit parameters use correct separator.

=== Release Notes ===
==== New features ====

When requesting `account_info` for the open ledger, include the `queue :
true` to get extra information about any queued transactions for this
account. (RIPD-1205).

==== Bug fixes ====

When using sign-and-submit mode to autofill a transaction's sequence
number, the logic will not reuse a sequence number that is in the queue
for this account. (RIPD-1206).

Labels for experimental "x_queue_okay" and "x_assume_tx" parameters to
`sign` and `submit` updated to use correct separator.
This commit is contained in:
Edward Hennis
2016-06-29 19:37:19 -04:00
parent 348e65074e
commit e762d09e7e
10 changed files with 714 additions and 37 deletions

View File

@@ -428,7 +428,21 @@ transactionPreProcessImpl (
return rpcError (rpcSRC_ACT_NOT_FOUND);
}
tx_json[jss::Sequence] = (*sle)[sfSequence];
auto seq = (*sle)[sfSequence];
auto const queued = app.getTxQ().getAccountTxs(srcAddressID,
app.config(), *ledger);
// If the account has any txs in the TxQ, skip those sequence
// numbers (accounting for possible gaps).
if(queued)
for(auto const& tx : *queued)
{
if (tx.first == seq)
++seq;
else if (tx.first > seq)
break;
}
tx_json[jss::Sequence] = seq;
}
if (!tx_json.isMember (jss::Flags))
@@ -680,9 +694,9 @@ Json::Value checkFee (
ledger->fees().base, ledger->fees().units, isUnlimited (role));
std::uint64_t fee = loadFee;
{
auto const assumeTx = request.isMember("x-assume-tx") &&
request["x-assume-tx"].isConvertibleTo(Json::uintValue) ?
request["x-assume-tx"].asUInt() : 0;
auto const assumeTx = request.isMember("x_assume_tx") &&
request["x_assume_tx"].isConvertibleTo(Json::uintValue) ?
request["x_assume_tx"].asUInt() : 0;
auto const metrics = txQ.getMetrics(config, *ledger, assumeTx);
if(metrics)
{
@@ -702,9 +716,9 @@ Json::Value checkFee (
mult, div);
if (fee > limit && fee != loadFee &&
request.isMember("x-queue-okay") &&
request["x-queue-okay"].isBool() &&
request["x-queue-okay"].asBool())
request.isMember("x_queue_okay") &&
request["x_queue_okay"].isBool() &&
request["x_queue_okay"].asBool())
{
fee = std::max(loadFee, limit);
}