mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +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
@@ -1350,6 +1350,31 @@ struct Flow_test : public beast::unit_test::suite
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testTicketPay(FeatureBitset features)
|
||||
{
|
||||
testcase("Payment with ticket");
|
||||
using namespace jtx;
|
||||
|
||||
auto const alice = Account("alice");
|
||||
auto const bob = Account("bob");
|
||||
|
||||
Env env(*this, features);
|
||||
BEAST_EXPECT(features[featureTicketBatch]);
|
||||
|
||||
env.fund(XRP(10000), alice);
|
||||
|
||||
// alice creates a ticket for the payment.
|
||||
std::uint32_t const ticketSeq{env.seq(alice) + 1};
|
||||
env(ticket::create(alice, 1));
|
||||
|
||||
// Make a payment using the ticket.
|
||||
env(pay(alice, bob, XRP(1000)), ticket::use(ticketSeq));
|
||||
env.close();
|
||||
env.require(balance(bob, XRP(1000)));
|
||||
env.require(balance(alice, XRP(9000) - drops(20)));
|
||||
}
|
||||
|
||||
void
|
||||
testWithFeats(FeatureBitset features)
|
||||
{
|
||||
@@ -1370,6 +1395,7 @@ struct Flow_test : public beast::unit_test::suite
|
||||
testUnfundedOffer(features);
|
||||
testReexecuteDirectStep(features);
|
||||
testSelfPayLowQualityOffer(features);
|
||||
testTicketPay(features);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1381,7 +1407,7 @@ struct Flow_test : public beast::unit_test::suite
|
||||
testRIPD1449();
|
||||
|
||||
using namespace jtx;
|
||||
auto const sa = supported_amendments();
|
||||
auto const sa = supported_amendments() | featureTicketBatch;
|
||||
testWithFeats(sa - featureFlowCross);
|
||||
testWithFeats(sa);
|
||||
testEmptyStrand(sa);
|
||||
@@ -1394,7 +1420,7 @@ struct Flow_manual_test : public Flow_test
|
||||
run() override
|
||||
{
|
||||
using namespace jtx;
|
||||
auto const all = supported_amendments();
|
||||
auto const all = supported_amendments() | featureTicketBatch;
|
||||
FeatureBitset const flowCross{featureFlowCross};
|
||||
FeatureBitset const f1513{fix1513};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user