Skip to content

Commit 338f164

Browse files
authored
Perform math.ceil for fee computation (#313)
1 parent 7cddd5d commit 338f164

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pycardano/utils.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import math
56
from typing import Dict, List, Optional, Union
67

78
import cbor2
@@ -43,11 +44,11 @@ def fee(
4344
Return:
4445
int: Minimum acceptable transaction fee.
4546
"""
46-
return (
47-
int(length * context.protocol_param.min_fee_coefficient)
48-
+ int(context.protocol_param.min_fee_constant)
49-
+ int(exec_steps * context.protocol_param.price_step)
50-
+ int(max_mem_unit * context.protocol_param.price_mem)
47+
return int(
48+
math.ceil(length * context.protocol_param.min_fee_coefficient)
49+
+ math.ceil(context.protocol_param.min_fee_constant)
50+
+ math.ceil(exec_steps * context.protocol_param.price_step)
51+
+ math.ceil(max_mem_unit * context.protocol_param.price_mem)
5152
)
5253

5354

0 commit comments

Comments
 (0)