Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

AccountTransaction::handle_fee should not take &self as arg #1770

Description

@tdelabro
    fn handle_fee(
        &self,
        state: &mut dyn State,
        tx_context: Arc<TransactionContext>,
        actual_fee: Fee,
        charge_fee: bool,
    ) -> TransactionExecutionResult<Option<CallInfo>> {
        if !charge_fee || actual_fee == Fee(0) {
            // Fee charging is not enforced in some transaction simulations and tests.
            return Ok(None);
        }

        // Charge fee.
        let fee_transfer_call_info = Self::execute_fee_transfer(state, tx_context, actual_fee)?;

        Ok(Some(fee_transfer_call_info))
    }

&self is not used. It can be removed and implemented as a type function, like Self::execute_fee_transfer it internally calls.
Or even as a standalone function as it does not use anything associated with the type like type constants or anything else

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions