File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
src/aleph/vm/orchestrator Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 21
21
22
22
from aleph .vm .conf import settings
23
23
from aleph .vm .orchestrator .utils import (
24
+ format_cost ,
24
25
get_community_wallet_address ,
25
26
is_after_community_wallet_start ,
26
27
)
@@ -238,9 +239,11 @@ async def check_payment(pool: VmPool):
238
239
logger .info ("flow community %s" , executions_with_community )
239
240
logger .info ("flow without community %s" , executions_without_community )
240
241
required_stream_without_community = await compute_required_flow (executions_without_community )
241
-
242
- required_crn_stream = required_stream * (1 - COMMUNITY_STREAM_RATIO ) + required_stream_without_community
243
- required_community_stream = required_stream * COMMUNITY_STREAM_RATIO
242
+ # TODO, rounding should be done per executions to not have the extra accumulate before rounding
243
+ required_crn_stream = format_cost (
244
+ required_stream * (1 - COMMUNITY_STREAM_RATIO ) + required_stream_without_community
245
+ )
246
+ required_community_stream = format_cost (required_stream * COMMUNITY_STREAM_RATIO )
244
247
logger .debug (
245
248
f"Stream for senders { sender } { len (executions )} executions. CRN : { stream } / { required_crn_stream } ."
246
249
f"Community: { community_stream } / { required_community_stream } "
Original file line number Diff line number Diff line change @@ -539,7 +539,7 @@ async def notify_allocation(request: web.Request):
539
539
required_crn_stream = format_cost (required_flow * (1 - COMMUNITY_STREAM_RATIO ))
540
540
required_community_stream = format_cost (required_flow * COMMUNITY_STREAM_RATIO )
541
541
else : # No community wallet payment
542
- required_crn_stream = required_flow
542
+ required_crn_stream = format_cost ( required_flow )
543
543
required_community_stream = Decimal (0 )
544
544
545
545
if active_flow < (required_crn_stream - settings .PAYMENT_BUFFER ):
You can’t perform that action at this time.
0 commit comments