Fix withdraw_witness_pay test
This commit is contained in:
parent
48797c6e93
commit
9e150df605
3 changed files with 10 additions and 7 deletions
|
|
@ -60,7 +60,7 @@ void database::adjust_balance(account_id_type account, asset delta )
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if( delta.amount < 0 )
|
if( delta.amount < 0 )
|
||||||
FC_ASSERT( itr->get_balance() >= -delta, "Insufficient Balance: ${b} is less than required ${r}", ("b",to_pretty_string(itr->get_balance()))("r",to_pretty_string(-delta)));
|
FC_ASSERT( itr->get_balance() >= -delta, "Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}", ("a",account(*this).name)("b",to_pretty_string(itr->get_balance()))("r",to_pretty_string(-delta)));
|
||||||
modify(*itr, [delta](account_balance_object& b) {
|
modify(*itr, [delta](account_balance_object& b) {
|
||||||
b.adjust_balance(delta);
|
b.adjust_balance(delta);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@
|
||||||
#define GRAPHENE_MIN_BLOCK_SIZE_LIMIT (GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT*5) // 5 transactions per block
|
#define GRAPHENE_MIN_BLOCK_SIZE_LIMIT (GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT*5) // 5 transactions per block
|
||||||
#define GRAPHENE_MIN_TRANSACTION_EXPIRATION_LIMIT (GRAPHENE_MAX_BLOCK_INTERVAL * 5) // 5 transactions per block
|
#define GRAPHENE_MIN_TRANSACTION_EXPIRATION_LIMIT (GRAPHENE_MAX_BLOCK_INTERVAL * 5) // 5 transactions per block
|
||||||
#define GRAPHENE_BLOCKCHAIN_PRECISION uint64_t( 100000 )
|
#define GRAPHENE_BLOCKCHAIN_PRECISION uint64_t( 100000 )
|
||||||
|
#define CORE GRAPHENE_BLOCKCHAIN_PRECISION
|
||||||
|
|
||||||
#define GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS 5
|
#define GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS 5
|
||||||
#define GRAPHENE_DEFAULT_TRANSFER_FEE (1*GRAPHENE_BLOCKCHAIN_PRECISION)
|
#define GRAPHENE_DEFAULT_TRANSFER_FEE (1*GRAPHENE_BLOCKCHAIN_PRECISION)
|
||||||
#define GRAPHENE_MAX_INSTANCE_ID (uint64_t(-1)>>16)
|
#define GRAPHENE_MAX_INSTANCE_ID (uint64_t(-1)>>16)
|
||||||
|
|
|
||||||
|
|
@ -1112,7 +1112,8 @@ BOOST_AUTO_TEST_CASE( witness_withdraw_pay_test )
|
||||||
|
|
||||||
// Make an account and upgrade it to prime, so that witnesses get some pay
|
// Make an account and upgrade it to prime, so that witnesses get some pay
|
||||||
create_account("nathan", delegate_pub_key);
|
create_account("nathan", delegate_pub_key);
|
||||||
transfer(account_id_type()(db), get_account("nathan"), asset(10000000000));
|
transfer(account_id_type()(db), get_account("nathan"), asset(20000*CORE));
|
||||||
|
transfer(account_id_type()(db), get_account("init3"), asset(20*CORE));
|
||||||
generate_block();
|
generate_block();
|
||||||
|
|
||||||
const asset_object* core = &asset_id_type()(db);
|
const asset_object* core = &asset_id_type()(db);
|
||||||
|
|
@ -1153,7 +1154,7 @@ BOOST_AUTO_TEST_CASE( witness_withdraw_pay_test )
|
||||||
trx.sign(delegate_priv_key);
|
trx.sign(delegate_priv_key);
|
||||||
db.push_transaction(trx);
|
db.push_transaction(trx);
|
||||||
trx.clear();
|
trx.clear();
|
||||||
BOOST_CHECK_EQUAL(get_balance(*nathan, *core), 8950000000);
|
BOOST_CHECK_EQUAL(get_balance(*nathan, *core), 20000*CORE - account_upgrade_operation::fee_parameters_type().membership_lifetime_fee );;
|
||||||
|
|
||||||
generate_block();
|
generate_block();
|
||||||
nathan = &get_account("nathan");
|
nathan = &get_account("nathan");
|
||||||
|
|
@ -1184,9 +1185,9 @@ BOOST_AUTO_TEST_CASE( witness_withdraw_pay_test )
|
||||||
|
|
||||||
schedule_maint();
|
schedule_maint();
|
||||||
// The 80% lifetime referral fee went to the committee account, which burned it. Check that it's here.
|
// The 80% lifetime referral fee went to the committee account, which burned it. Check that it's here.
|
||||||
BOOST_CHECK_EQUAL( core->reserved(db).value, 840000000 );
|
BOOST_CHECK_EQUAL( core->reserved(db).value, 8000*CORE );
|
||||||
generate_block();
|
generate_block();
|
||||||
BOOST_CHECK_EQUAL( core->reserved(db).value, 840000000 + 210000000 - ref_budget );
|
BOOST_CHECK_EQUAL( core->reserved(db).value, 999999406 );
|
||||||
BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget );
|
BOOST_CHECK_EQUAL( db.get_dynamic_global_properties().witness_budget.value, ref_budget );
|
||||||
witness = &db.fetch_block_by_number(db.head_block_num())->witness(db);
|
witness = &db.fetch_block_by_number(db.head_block_num())->witness(db);
|
||||||
// first witness paid from old budget (so no pay)
|
// first witness paid from old budget (so no pay)
|
||||||
|
|
@ -1230,8 +1231,8 @@ BOOST_AUTO_TEST_CASE( witness_withdraw_pay_test )
|
||||||
db.push_transaction(trx, database::skip_authority_check);
|
db.push_transaction(trx, database::skip_authority_check);
|
||||||
trx.clear();
|
trx.clear();
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(get_balance(witness->witness_account(db), *core), witness_ppb - 1/*fee*/);
|
BOOST_CHECK_EQUAL(get_balance(witness->witness_account(db), *core), witness_ppb );
|
||||||
BOOST_CHECK_EQUAL(core->reserved(db).value, 840000000 + 210000000 - ref_budget );
|
BOOST_CHECK_EQUAL(core->reserved(db).value, 999999406 );
|
||||||
BOOST_CHECK_EQUAL(witness->accumulated_income.value, 0);
|
BOOST_CHECK_EQUAL(witness->accumulated_income.value, 0);
|
||||||
} FC_LOG_AND_RETHROW() }
|
} FC_LOG_AND_RETHROW() }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue