@@ -1272,46 +1272,23 @@ BOOST_AUTO_TEST_CASE( unlock_operation_penalty_payment_test )
1272
1272
{
1273
1273
INVOKE (make_recursive_authority_test);
1274
1274
1275
- generate_blocks (HARDFORK_1268_TIME);
1276
- generate_block ();
1277
-
1278
1275
GET_ACTOR (bob);
1279
1276
fund (bob);
1280
1277
ACTOR (issuer);
1281
1278
1282
- additional_asset_options_t options;
1283
- options.value .reward_percent = 2 * GRAPHENE_1_PERCENT;
1284
-
1285
- const auto usd = create_user_issued_asset (
1286
- " USD" ,
1287
- issuer,
1288
- charge_market_fee,
1289
- price (asset (1 , asset_id_type (1 )), asset (1 )),
1290
- 1 ,
1291
- 20 * GRAPHENE_1_PERCENT,
1292
- options);
1279
+ const auto usd = create_user_issued_asset (" USD" );
1293
1280
1294
1281
issue_uia (issuer, usd.amount (2000 ));
1295
1282
transfer (issuer, bob, usd.amount (200 ));
1296
1283
transfer (issuer, GRAPHENE_COMMITTEE_ACCOUNT (db), usd.amount (200 ));
1297
1284
1298
- std::map<asset_id_type, share_type> bob_balance_helper ;
1299
- std::map<asset_id_type, share_type> committee_balance_helper ;
1285
+ auto initial_balance_bob_BTS = get_balance (bob_id, asset_id_type ()) ;
1286
+ auto initial_balance_bob_USD = get_balance (bob_id, usd. get_id ()) ;
1300
1287
1301
- const auto & bal_idx_before = db.get_index_type < primary_index< account_balance_index > >().get_secondary_index < balances_by_account_index >();
1302
- for ( const auto & entry : bal_idx_before.get_account_balances ( bob_id ) )
1303
- {
1304
- const auto balance = entry.second ->get_balance ();
1305
- bob_balance_helper.emplace (balance.asset_id , balance.amount );
1306
- BOOST_CHECK_GT (balance.amount .value , 0 );
1307
- }
1308
- for ( const auto & entry : bal_idx_before.get_account_balances ( GRAPHENE_COMMITTEE_ACCOUNT ) )
1309
- {
1310
- const auto balance = entry.second ->get_balance ();
1311
- committee_balance_helper.emplace (balance.asset_id , balance.amount );
1312
- BOOST_CHECK_GT (balance.amount .value , 0 );
1313
- }
1314
-
1288
+ auto initial_balance_committee_BTS = get_balance ( GRAPHENE_COMMITTEE_ACCOUNT, asset_id_type ());
1289
+ auto initial_balance_committee_USD = get_balance ( GRAPHENE_COMMITTEE_ACCOUNT, usd.get_id ());
1290
+
1291
+ generate_blocks (HARDFORK_CYCLED_ACCOUNTS_TIME);
1315
1292
// unlock
1316
1293
{
1317
1294
account_unlock_operation op;
@@ -1326,40 +1303,27 @@ BOOST_AUTO_TEST_CASE( unlock_operation_penalty_payment_test )
1326
1303
PUSH_TX ( db, trx );
1327
1304
}
1328
1305
1329
- const auto & bal_idx_after = db.get_index_type < primary_index< account_balance_index > >().get_secondary_index < balances_by_account_index >();
1330
- for ( const auto & entry : bal_idx_after.get_account_balances ( bob_id ) )
1331
- {
1332
- const auto balance = entry.second ->get_balance ();
1333
- BOOST_CHECK_EQUAL (balance.amount .value , bob_balance_helper.at (balance.asset_id ).value * 0.9 );
1334
- }
1306
+ BOOST_CHECK_EQUAL ( get_balance (bob_id, asset_id_type ()), initial_balance_bob_BTS * 0.9 );
1307
+ BOOST_CHECK_EQUAL ( get_balance (bob_id, usd.get_id ()), initial_balance_bob_USD * 0.9 );
1335
1308
1336
- for ( const auto & entry : bal_idx_after.get_account_balances ( GRAPHENE_COMMITTEE_ACCOUNT ) )
1337
- {
1338
- const auto balance = entry.second ->get_balance ();
1339
- BOOST_CHECK_EQUAL (balance.amount .value - committee_balance_helper.at (balance.asset_id ).value , bob_balance_helper.at (balance.asset_id ).value * 0.1 );
1340
- }
1309
+ BOOST_CHECK_EQUAL ( get_balance (GRAPHENE_COMMITTEE_ACCOUNT, asset_id_type ()), initial_balance_committee_BTS + initial_balance_bob_BTS * 0.1 );
1310
+ BOOST_CHECK_EQUAL ( get_balance (GRAPHENE_COMMITTEE_ACCOUNT, usd.get_id ()), initial_balance_committee_USD + initial_balance_bob_USD * 0.1 );
1341
1311
1342
1312
} FC_LOG_AND_RETHROW ()
1343
1313
}
1344
1314
1345
- BOOST_AUTO_TEST_CASE (unloc_account_operation_failed_not_enough_BTS )
1315
+ BOOST_AUTO_TEST_CASE (unlock_account_operation_failed_not_enough_BTS )
1346
1316
{
1347
1317
try
1348
1318
{
1349
1319
INVOKE (make_recursive_authority_test);
1350
1320
1351
- generate_blocks (HARDFORK_1268_TIME );
1321
+ generate_blocks (HARDFORK_CYCLED_ACCOUNTS_TIME );
1352
1322
generate_block ();
1353
1323
1354
1324
GET_ACTOR (bob);
1355
1325
enable_fees ();
1356
1326
1357
- std::map<asset_id_type, share_type> bob_balance_helper;
1358
- std::map<asset_id_type, share_type> committee_balance_helper;
1359
-
1360
- const auto & bal_idx_before = db.get_index_type < primary_index< account_balance_index > >().get_secondary_index < balances_by_account_index >();
1361
- BOOST_CHECK ( bal_idx_before.get_account_balances ( bob_id ).size () == 0 );
1362
-
1363
1327
// unlock
1364
1328
account_unlock_operation op;
1365
1329
op.account_to_unlock = bob_id;
@@ -1371,7 +1335,7 @@ BOOST_AUTO_TEST_CASE(unloc_account_operation_failed_not_enough_BTS)
1371
1335
sign (trx, bob_private_key);
1372
1336
1373
1337
GRAPHENE_CHECK_THROW ( PUSH_TX ( db, trx ), fc::exception );
1374
-
1338
+
1375
1339
} FC_LOG_AND_RETHROW ()
1376
1340
}
1377
1341
0 commit comments