Skip to content

Commit

Permalink
Update src/tribler/core/components/bandwidth_accounting/db/database.py
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Kozlovsky <[email protected]>
  • Loading branch information
drew2a and kozlovsky authored Mar 21, 2022
1 parent f179053 commit 8d9c54e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def get_latest_transaction(self, public_key_a: bytes, public_key_b: bytes) -> Ba
"""
db_txs = select(tx for tx in self.BandwidthTransaction
if public_key_a == tx.public_key_a and public_key_b == tx.public_key_b) \
.order_by(desc(self.BandwidthTransaction.timestamp)) \
.order_by(lambda tx: desc(tx.sequence_number)) \
.limit(1)

return BandwidthTransactionData.from_db(db_txs[0]) if len(db_txs) == 1 else None
Expand Down

0 comments on commit 8d9c54e

Please sign in to comment.