Implement enhanced Ticket support:

Tickets are a mechanism to allow for the "out-of-order" execution of
transactions on the XRP Ledger.

This commit, if merged, reworks the existing support for tickets and
introduces support for 'ticket batching', completing the feature set
needed for tickets.

The code is gated under the newly-introduced `TicketBatch` amendment
and the `Tickets` amendment, which is not presently active on the
network, is being removed.

The specification for this change can be found at:
https://github.com/xrp-community/standards-drafts/issues/16
This commit is contained in:
Scott Schurr
2018-10-18 18:43:02 -07:00
committed by Nik Bougalis
parent 01bd5a2646
commit 7724cca384
101 changed files with 6337 additions and 2287 deletions

View File

@@ -106,6 +106,40 @@ public:
}
}
void
testTicketSetTrust()
{
testcase("SetTrust using a ticket");
using namespace jtx;
// Verify that TrustSet transactions can use tickets.
Env env{*this, supported_amendments() | featureTicketBatch};
auto const gw = Account{"gateway"};
auto const alice = Account{"alice"};
auto const USD = gw["USD"];
env.fund(XRP(10000), gw, alice);
env.close();
// Cannot pay alice without a trustline.
env(pay(gw, alice, USD(200)), ter(tecPATH_DRY));
env.close();
// Create a ticket.
std::uint32_t const ticketSeq{env.seq(alice) + 1};
env(ticket::create(alice, 1));
env.close();
// Use that ticket to create a trust line.
env(trust(alice, USD(1000)), ticket::use(ticketSeq));
env.close();
// Now the payment succeeds.
env(pay(gw, alice, USD(200)));
env.close();
}
Json::Value
trust_explicit_amt(jtx::Account const& a, STAmount const& amt)
{
@@ -223,6 +257,7 @@ public:
// true, true case doesn't matter since creating a trustline ledger
// entry requires reserve from the creator
// independent of hi/low account ids for endpoints
testTicketSetTrust();
testMalformedTransaction();
testModifyQualityOfTrustline(false, false);
testModifyQualityOfTrustline(false, true);