Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for wrong closure_time in settlement payments #1021

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions concent_api/core/payments/bankster.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ def settle_overdue_acceptances(
# subtask_results_accepted_list.
oldest_payments_ts = min(subtask_results_accepted.payment_ts for subtask_results_accepted in acceptances)

cut_off_time = get_current_utc_timestamp()

# Concent gets list of transactions from payment API where timestamp >= T0.
list_of_transactions = service.get_list_of_payments( # pylint: disable=no-value-for-parameter
requestor_eth_address=requestor_ethereum_address,
Expand Down Expand Up @@ -394,11 +392,15 @@ def settle_overdue_acceptances(
if requestor_payable_amount <= 0:
return None

# This is time T2 (end time) equal to youngest payment_ts from passed SubtaskResultAccepted messages from
# subtask_results_accepted_list.
youngest_payments_ts = max(subtask_results_accepted.payment_ts for subtask_results_accepted in acceptances)

transaction_hash = service.make_force_payment_to_provider( # pylint: disable=no-value-for-parameter
requestor_eth_address=requestor_ethereum_address,
provider_eth_address=provider_ethereum_address,
value=requestor_payable_amount,
payment_ts=cut_off_time,
payment_ts=youngest_payments_ts,
)
transaction_hash = adjust_transaction_hash(transaction_hash)

Expand Down