GolosChain / golos

Socio-economic mediablockchain
https://developers.golos.io
Other
59 stars 35 forks source link

delegate_vesting_shares_operation perceiving as try to change interest rate #1367

Closed maslenitsa93 closed 4 years ago

maslenitsa93 commented 4 years ago

Code:

void delegate_vesting_shares(..., uint16_t interest_rate) {
    ...
    if (delegation) {
        GOLOS_CHECK_LOGIC(delegation->interest_rate == interest_rate,
            logic_exception::cannot_change_delegator_interest_rate,
            "Cannot change interest rate of already created delegation");
    }
    ...
}

void delegate_vesting_shares_evaluator::do_apply(const delegate_vesting_shares_operation& op) {
    const auto& median_props = _db.get_witness_schedule_object().median_props;

    delegate_vesting_shares(..., 0);
}

Following case possible:

  1. delegate_vesting_shares_with_interest sets interest_rate to 25.
  2. delegate_vesting_shares calling to increase/decrease this delegation, not for change interest_rate.
  3. But this check 25 == 0 thinks that it is changing.

In older version, only delegate_vesting_shares_with_interest has such check.