diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 19247aef..afdafc12 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -624,8 +624,9 @@ class wallet_api * portion of the user's transaction fees. This can be the * same as the registrar_account if there is no referrer. * @param referrer_percent the percentage (0 - 100) of the new user's transaction fees - * not claimed by the blockchain that will be distributed to the - * referrer; the rest will be sent to the registrar + * not claimed by the blockchain that will be distributed to the + * referrer; the rest will be sent to the registrar. Will be + * multiplied by GRAPHENE_1_PERCENT when constructing the transaction. * @param broadcast true to broadcast the transaction on the network * @returns the signed transaction registering the account */ @@ -634,7 +635,7 @@ class wallet_api public_key_type active, string registrar_account, string referrer_account, - uint8_t referrer_percent, + uint32_t referrer_percent, bool broadcast = false); /** diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 0cb8dceb..1f8855c5 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -890,13 +890,17 @@ public: public_key_type active, string registrar_account, string referrer_account, - uint8_t referrer_percent, + uint32_t referrer_percent, bool broadcast = false) { try { FC_ASSERT( !self.is_locked() ); FC_ASSERT( is_valid_name(name) ); account_create_operation account_create_op; + // #449 referrer_percent is on 0-100 scale, if user has larger + // number it means their script is using GRAPHENE_100_PERCENT scale + // instead of 0-100 scale. + FC_ASSERT( referrer_percent <= 100 ); // TODO: process when pay_from_account is ID account_object registrar_account_object = @@ -908,7 +912,7 @@ public: account_object referrer_account_object = this->get_account( referrer_account ); account_create_op.referrer = referrer_account_object.id; - account_create_op.referrer_percent = referrer_percent; + account_create_op.referrer_percent = uint16_t( referrer_percent * GRAPHENE_1_PERCENT ); account_create_op.registrar = registrar_account_id; account_create_op.name = name; @@ -2922,7 +2926,7 @@ signed_transaction wallet_api::register_account(string name, public_key_type active_pubkey, string registrar_account, string referrer_account, - uint8_t referrer_percent, + uint32_t referrer_percent, bool broadcast) { return my->register_account( name, owner_pubkey, active_pubkey, registrar_account, referrer_account, referrer_percent, broadcast ); diff --git a/tests/tests/fee_tests.cpp b/tests/tests/fee_tests.cpp index e65cb92b..643caaf5 100644 --- a/tests/tests/fee_tests.cpp +++ b/tests/tests/fee_tests.cpp @@ -163,6 +163,7 @@ BOOST_AUTO_TEST_CASE(asset_claim_fees_test) } + if( db.head_block_time() <= HARDFORK_413_TIME ) { // can't claim before hardfork GRAPHENE_REQUIRE_THROW( claim_fees( izzy_id, _izzy(1) ), fc::exception ); diff --git a/tests/tests/operation_tests2.cpp b/tests/tests/operation_tests2.cpp index 9021f621..b7e9cf11 100644 --- a/tests/tests/operation_tests2.cpp +++ b/tests/tests/operation_tests2.cpp @@ -1229,6 +1229,11 @@ BOOST_AUTO_TEST_CASE(zero_second_vbo) upgrade_to_lifetime_member(alice_id); generate_block(); + // Wait for a maintenance interval to ensure we have a full day's budget to work with. + // Otherwise we may not have enough to feed the witnesses and the worker will end up starved if we start late in the day. + generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); + generate_block(); + auto check_vesting_1b = [&](vesting_balance_id_type vbid) { // this function checks that Alice can't draw any right now, @@ -1304,8 +1309,6 @@ BOOST_AUTO_TEST_CASE(zero_second_vbo) // vote it in, wait for one maint. for vote to take effect vesting_balance_id_type vbid = wid(db).worker.get().balance; - generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); - generate_block(); // wait for another maint. for worker to be paid generate_blocks(db.get_dynamic_global_properties().next_maintenance_time); BOOST_CHECK( vbid(db).get_allowed_withdraw(db.head_block_time()) == asset(0) );