Skip to content

Commit

Permalink
Perform math.ceil for fee computation (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
nielstron committed Feb 20, 2024
1 parent 7cddd5d commit 338f164
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pycardano/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import math
from typing import Dict, List, Optional, Union

import cbor2
Expand Down Expand Up @@ -43,11 +44,11 @@ def fee(
Return:
int: Minimum acceptable transaction fee.
"""
return (
int(length * context.protocol_param.min_fee_coefficient)
+ int(context.protocol_param.min_fee_constant)
+ int(exec_steps * context.protocol_param.price_step)
+ int(max_mem_unit * context.protocol_param.price_mem)
return int(
math.ceil(length * context.protocol_param.min_fee_coefficient)
+ math.ceil(context.protocol_param.min_fee_constant)
+ math.ceil(exec_steps * context.protocol_param.price_step)
+ math.ceil(max_mem_unit * context.protocol_param.price_mem)
)


Expand Down

0 comments on commit 338f164

Please sign in to comment.