@@ -1056,28 +1056,7 @@ struct Escrow_test : public beast::unit_test::suite
1056
1056
auto const carol = Account (" carol" );
1057
1057
1058
1058
{
1059
- testcase (" Metadata & Ownership (without fix1523)" );
1060
- Env env (*this , supported_amendments () - fix1523);
1061
- env.fund (XRP (5000 ), alice, bruce, carol);
1062
-
1063
- auto const seq = env.seq (alice);
1064
- env (escrow (alice, carol, XRP (1000 )), finish_time (env.now () + 1s));
1065
-
1066
- BEAST_EXPECT ((*env.meta ())[sfTransactionResult] ==
1067
- static_cast <std::uint8_t >(tesSUCCESS));
1068
-
1069
- auto const escrow = env.le (keylet::escrow (alice.id (), seq));
1070
- BEAST_EXPECT (escrow);
1071
-
1072
- ripple::Dir aod (*env.current (), keylet::ownerDir (alice.id ()));
1073
- BEAST_EXPECT (std::distance (aod.begin (), aod.end ()) == 1 );
1074
- BEAST_EXPECT (std::find (aod.begin (), aod.end (), escrow) != aod.end ());
1075
-
1076
- ripple::Dir cod (*env.current (), keylet::ownerDir (carol.id ()));
1077
- BEAST_EXPECT (cod.begin () == cod.end ());
1078
- }
1079
- {
1080
- testcase (" Metadata (with fix1523, to self)" );
1059
+ testcase (" Metadata to self" );
1081
1060
1082
1061
Env env (*this );
1083
1062
env.fund (XRP (5000 ), alice, bruce, carol);
@@ -1141,7 +1120,7 @@ struct Escrow_test : public beast::unit_test::suite
1141
1120
}
1142
1121
}
1143
1122
{
1144
- testcase (" Metadata (with fix1523, to other) " );
1123
+ testcase (" Metadata to other" );
1145
1124
1146
1125
Env env (*this );
1147
1126
env.fund (XRP (5000 ), alice, bruce, carol);
@@ -1266,139 +1245,6 @@ struct Escrow_test : public beast::unit_test::suite
1266
1245
}
1267
1246
}
1268
1247
1269
- void testDeletedDestination ()
1270
- {
1271
- // Make sure an Escrow behaves as expected if its destination is
1272
- // deleted from the ledger. This can only happen if fix1523 is
1273
- // not enabled. fix1523 is what adds the Escrow to the Escrow's
1274
- // destination directory.
1275
- testcase (" Deleted destination" );
1276
-
1277
- using namespace jtx ;
1278
- using namespace std ::chrono;
1279
-
1280
- Account const alice {" alice" };
1281
- Account const bruce {" bruce" };
1282
- Account const carol {" carol" };
1283
- Account const daria {" daria" };
1284
- Account const evita {" evita" };
1285
- Account const fiona {" fiona" };
1286
- Account const grace {" grace" };
1287
-
1288
- Env env (*this , supported_amendments () - fix1523);
1289
-
1290
- env.fund (XRP (5000 ), alice, bruce, carol, daria, evita, fiona, grace);
1291
- env.close ();
1292
-
1293
- // Because fix1523 is not in play, bruce does not have a back link
1294
- // from his directory to the escrow. So we should be able to delete
1295
- // bruce's account even though he is the destination of an escrow.
1296
- std::uint32_t const aliceEscrowSeq {env.seq (alice)};
1297
- env (escrow (alice, bruce, XRP (1000 )), finish_time (env.now () + 1s));
1298
-
1299
- // Similar to bruce, we should be able to delete daria's account.
1300
- std::uint32_t const carolEscrowSeq {env.seq (carol)};
1301
- env (escrow (carol, daria, XRP (1000 )),
1302
- finish_time (env.now () + 1s), cancel_time (env.now () + 2s));
1303
- env.close ();
1304
-
1305
- // Now engage fix1523 so any additional escrows we make will have
1306
- // back links from both the source and the destination.
1307
- env.enableFeature (fix1523);
1308
- env.close ();
1309
-
1310
- // Neither evita not fiona should be able to delete their accounts
1311
- // once this escrow is created.
1312
- std::uint32_t const evitaEscrowSeq {env.seq (evita)};
1313
- env (escrow (evita, fiona, XRP (1000 )), finish_time (env.now () + 1s));
1314
- env.close ();
1315
-
1316
- // Close enough ledgers to be able to delete any of the accounts.
1317
- {
1318
- std::uint32_t const openLedgerSeq {env.current ()->seq ()};
1319
- int const delta = [&]()->int {
1320
- if (env.seq (alice) + 255 > openLedgerSeq)
1321
- return env.seq (alice) - openLedgerSeq + 255 ;
1322
- return 0 ;
1323
- }();
1324
- for (int i = 0 ; i < delta; ++i)
1325
- env.close ();
1326
- }
1327
-
1328
- // The presence of escrows should prevent all of the accounts from
1329
- // being deleted except for bruce and daria.
1330
- auto const acctDelFee {drops (env.current ()->fees ().increment )};
1331
- env (acctdelete (alice, grace), fee (acctDelFee), ter (tecHAS_OBLIGATIONS));
1332
- env (acctdelete (bruce, grace), fee (acctDelFee));
1333
- env (acctdelete (carol, grace), fee (acctDelFee), ter (tecHAS_OBLIGATIONS));
1334
- env (acctdelete (daria, grace), fee (acctDelFee));
1335
- env (acctdelete (evita, grace), fee (acctDelFee), ter (tecHAS_OBLIGATIONS));
1336
- env (acctdelete (fiona, grace), fee (acctDelFee), ter (tecHAS_OBLIGATIONS));
1337
- env.close ();
1338
-
1339
- // At this point the destination of alice's escrow is missing. Make
1340
- // sure the escrow still behaves well. In particular, an EscrowFinish
1341
- // should fail but leave the Escrow object in the ledger.
1342
- env (finish (alice, alice, aliceEscrowSeq), ter (tecNO_DST));
1343
- env.close ();
1344
-
1345
- // Verify that alice's escrow remains in the ledger.
1346
- Keylet const aliceEscrowKey {
1347
- keylet::escrow (alice.id (), aliceEscrowSeq)};
1348
- BEAST_EXPECT (env.current ()->exists (aliceEscrowKey));
1349
-
1350
- // Since alice still has the escrow she should not be able to delete
1351
- // her account.
1352
- env (acctdelete (alice, grace), fee (acctDelFee), ter (tecHAS_OBLIGATIONS));
1353
-
1354
- // The fact that the destination of carol's escrow has evaporated
1355
- // should have no impact on whether carol's escrow can be canceled.
1356
- env (cancel (carol, carol, carolEscrowSeq));
1357
- env.close ();
1358
-
1359
- // Now that carol's escrow is gone carol should be able to delete
1360
- // her account.
1361
- env (acctdelete (carol, grace), fee (acctDelFee));
1362
- env.close ();
1363
-
1364
- // We'll now resurrect bruce's account. alice should then be able to
1365
- // finish her escrow.
1366
- env (pay (grace, bruce, XRP (5000 )));
1367
- env.close ();
1368
-
1369
- // bruce's account should have returned to the ledger.
1370
- BEAST_EXPECT (env.current ()->exists (keylet::account (bruce.id ())));
1371
- BEAST_EXPECT (env.balance (bruce) == XRP (5000 ));
1372
-
1373
- // Verify that alice's escrow is still in the ledger.
1374
- BEAST_EXPECT (env.current ()->exists (aliceEscrowKey));
1375
-
1376
- // alice finishes her escrow to bruce's resurrected account.
1377
- env (finish (alice, alice, aliceEscrowSeq));
1378
- env.close ();
1379
-
1380
- // Verify that alice's escrow is gone from the ledger.
1381
- BEAST_EXPECT (! env.current ()->exists (aliceEscrowKey));
1382
-
1383
- // Now alice can delete her account.
1384
- env (acctdelete (alice, grace), fee (acctDelFee));
1385
- env.close ();
1386
-
1387
- // eveta and fiona are still prevented from deletion by evita's escrow.
1388
- env (acctdelete (evita, grace), fee (acctDelFee), ter (tecHAS_OBLIGATIONS));
1389
- env (acctdelete (fiona, grace), fee (acctDelFee), ter (tecHAS_OBLIGATIONS));
1390
- env.close ();
1391
-
1392
- // Finish evita's escrow. Then both evita's and fiona's accounts can
1393
- // be deleted.
1394
- env (finish (fiona, evita, evitaEscrowSeq));
1395
- env.close ();
1396
-
1397
- env (acctdelete (evita, grace), fee (acctDelFee));
1398
- env (acctdelete (fiona, grace), fee (acctDelFee));
1399
- env.close ();
1400
- }
1401
-
1402
1248
void run () override
1403
1249
{
1404
1250
testEnablement ();
@@ -1411,7 +1257,6 @@ struct Escrow_test : public beast::unit_test::suite
1411
1257
testEscrowConditions ();
1412
1258
testMetaAndOwnership ();
1413
1259
testConsequences ();
1414
- testDeletedDestination ();
1415
1260
}
1416
1261
};
1417
1262
0 commit comments