mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 23:00:55 +00:00
refactor: Clean up tec object deletion logic (#6588)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -797,11 +797,13 @@ public:
|
||||
// The offer expires (it's not removed yet).
|
||||
env.close();
|
||||
env.require(Owners(bob, 1), offers(bob, 1));
|
||||
auto const expiredBobOffer = keylet::offer(bob, env.seq(bob) - 1);
|
||||
|
||||
// bob creates the offer that will be crossed.
|
||||
env(offer(bob, usd(500), XRP(500)), Ter(tesSUCCESS));
|
||||
env.close();
|
||||
env.require(Owners(bob, 2), offers(bob, 2));
|
||||
auto const crossedBobOffer = keylet::offer(bob, env.seq(bob) - 1);
|
||||
|
||||
env(trust(alice, usd(1000)), Ter(tesSUCCESS));
|
||||
env(pay(gw, alice, usd(1000)), Ter(tesSUCCESS));
|
||||
@@ -820,6 +822,8 @@ public:
|
||||
Balance(bob, usd(kNone)),
|
||||
Owners(bob, 1),
|
||||
offers(bob, 1));
|
||||
BEAST_EXPECT(!env.current()->exists(expiredBobOffer));
|
||||
BEAST_EXPECT(env.current()->exists(crossedBobOffer));
|
||||
|
||||
// Order that can be filled
|
||||
env(offer(alice, XRP(500), usd(500)), Txflags(tfFillOrKill), Ter(tesSUCCESS));
|
||||
@@ -835,6 +839,27 @@ public:
|
||||
offers(bob, 0));
|
||||
}
|
||||
|
||||
// A failed Fill-or-Kill may tentatively consume a funded offer before
|
||||
// the transaction is reset. That offer must not be treated as an
|
||||
// unfunded offer cleanup.
|
||||
{
|
||||
Env env{*this, features};
|
||||
|
||||
env.fund(startBalance, gw, alice, bob);
|
||||
env.close();
|
||||
|
||||
env(offer(bob, usd(500), XRP(500)), Ter(tesSUCCESS));
|
||||
env.close();
|
||||
auto const bobOffer = keylet::offer(bob, env.seq(bob) - 1);
|
||||
|
||||
env(trust(alice, usd(1000)), Ter(tesSUCCESS));
|
||||
env(pay(gw, alice, usd(1000)), Ter(tesSUCCESS));
|
||||
env(offer(alice, XRP(1000), usd(1000)), Txflags(tfFillOrKill), Ter(tecKILLED));
|
||||
|
||||
env.require(offers(alice, 0), offers(bob, 1), Balance(alice, usd(1000)));
|
||||
BEAST_EXPECT(env.current()->exists(bobOffer));
|
||||
}
|
||||
|
||||
// Immediate or Cancel - cross as much as possible
|
||||
// and add nothing on the books:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user