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

Ignore payout in the case of the OrmError happens #7236

Merged
merged 1 commit into from
Dec 27, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from ipv8.taskmanager import task
from ipv8.types import Address
from ipv8.util import succeed
from pony.orm import OrmError

from tribler.core import notifications
from tribler.core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData
Expand Down Expand Up @@ -322,7 +323,12 @@ def do_payout(self, peer: Peer, circuit_id: int, amount: int, base_amount: int)
self.logger.info("Sending payout of %d (base: %d) to %s (cid: %s)", amount, base_amount, peer, circuit_id)

tx = self.bandwidth_community.construct_signed_transaction(peer, amount)
self.bandwidth_community.database.BandwidthTransaction.insert(tx)
try:
self.bandwidth_community.database.BandwidthTransaction.insert(tx)
except OrmError as e:
self.logger.exception(e)
return

payload = BandwidthTransactionPayload.from_transaction(tx, circuit_id, base_amount)
packet = self._ez_pack(self._prefix, 30, [payload], False)
self.send_packet(peer, packet)
Expand Down