fix: Recycle the escrow reserve in EscrowCancel and EscrowFinish (#8142)

This commit is contained in:
Denis Angell
2026-09-03 16:27:45 +00:00
committed by GitHub
parent 2ddf6ee148
commit 37cb4cdbe3
4 changed files with 119 additions and 23 deletions

View File

@@ -5467,13 +5467,12 @@ public:
using namespace test::jtx;
using namespace std::chrono_literals;
// Finishing a self-escrow (source == destination) whose trust line
// was deleted while the escrow was outstanding auto-creates the line,
// and the outcome of that reserve check depends on whether the escrow
// reserve is released before delivery (Sponsor) or after (legacy).
// With the source's balance in the one-increment window
// [reserve(1), reserve(2)), the legacy order requires reserve(2) and
// fails, while the Sponsor order requires reserve(1) and succeeds.
// Finishing a self-escrow (source == destination) whose trust line was
// deleted while the escrow was outstanding auto-creates the line. With
// the source's balance in the one-increment window
// [reserve(1), reserve(2)), the finish succeeds only when the escrow
// reserve is released before delivery, which either featureSponsor or
// fixCleanup3_4_0 does.
auto runTest = [&](FeatureBitset features, TER expected) {
Account const alice("alice");
Account const gw("gw");
@@ -5538,11 +5537,9 @@ public:
}
};
// Pre-amendment: legacy order — the escrow still counts against the
// reserve while the auto-created line is checked.
runTest(testableAmendments() - featureSponsor, tecNO_LINE_INSUF_RESERVE);
// Post-amendment: the escrow reserve is recycled into the new line.
runTest(testableAmendments() - featureSponsor - fixCleanup3_4_0, tecNO_LINE_INSUF_RESERVE);
runTest(testableAmendments() - featureSponsor, tesSUCCESS);
runTest(testableAmendments() - fixCleanup3_4_0, tesSUCCESS);
runTest(testableAmendments(), tesSUCCESS);
}