@@ -2580,14 +2580,14 @@ namespace {
25802580template <typename Operation>
25812581void delegate_vesting_shares (
25822582 database& _db, const chain_properties& median_props, const Operation& op,
2583- const delegate_vesting_shares_with_interest_extensions_type* extensions, uint16_t interest_rate
2583+ const delegate_vesting_shares_with_interest_extensions_type* extensions, fc::optional< uint16_t > interest_rate
25842584) {
25852585 const auto & delegator = _db.get_account (op.delegator );
25862586 const auto & delegatee = _db.get_account (op.delegatee );
25872587 auto delegation = _db.find <vesting_delegation_object, by_delegation>(std::make_tuple (op.delegator , op.delegatee ));
25882588
2589- if (delegation) {
2590- GOLOS_CHECK_LOGIC (delegation->interest_rate == interest_rate,
2589+ if (delegation && !!interest_rate ) {
2590+ GOLOS_CHECK_LOGIC (delegation->interest_rate == * interest_rate,
25912591 logic_exception::cannot_change_delegator_interest_rate,
25922592 " Cannot change interest rate of already created delegation" );
25932593 }
@@ -2647,7 +2647,9 @@ void delegate_vesting_shares(
26472647 o.delegatee = op.delegatee ;
26482648 o.vesting_shares = op.vesting_shares ;
26492649 o.min_delegation_time = now;
2650- o.interest_rate = interest_rate;
2650+ if (!!interest_rate) {
2651+ o.interest_rate = *interest_rate;
2652+ }
26512653 });
26522654 } else {
26532655 _db.modify (*delegation, [&](vesting_delegation_object& o) {
@@ -2698,7 +2700,7 @@ void delegate_vesting_shares(
26982700 void delegate_vesting_shares_evaluator::do_apply (const delegate_vesting_shares_operation& op) {
26992701 const auto & median_props = _db.get_witness_schedule_object ().median_props ;
27002702
2701- delegate_vesting_shares (_db, median_props, op, nullptr , 0 );
2703+ delegate_vesting_shares (_db, median_props, op, nullptr , fc::optional< uint16_t >() );
27022704 }
27032705
27042706 void break_free_referral_evaluator::do_apply (const break_free_referral_operation& op) {
@@ -2730,7 +2732,7 @@ void delegate_vesting_shares(
27302732
27312733 GOLOS_CHECK_LIMIT_PARAM (op.interest_rate , median_props.max_delegated_vesting_interest_rate );
27322734
2733- delegate_vesting_shares (_db, median_props, op, &op.extensions , op.interest_rate );
2735+ delegate_vesting_shares (_db, median_props, op, &op.extensions , fc::optional< uint16_t >( op.interest_rate ) );
27342736 }
27352737
27362738 void reject_vesting_shares_delegation_evaluator::do_apply (const reject_vesting_shares_delegation_operation& op) {
0 commit comments