mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
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:
committed by
Nik Bougalis
parent
01bd5a2646
commit
7724cca384
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user