Skip to content

Commit

Permalink
fix: order transactions when looking up transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jul 12, 2024
1 parent 79895a9 commit 7773186
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions transactions/transactions_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ func (svc *transactionsService) LookupTransaction(ctx context.Context, paymentHa
}
}

// FIXME: this is currently not unique
result := tx.Find(&transaction, &db.Transaction{
// order settled first, otherwise by created date, as there can be multiple outgoing payments
// for the same payment hash (if you tried to pay an invoice multiple times - e.g. the first time failed)
result := tx.Order("settled_at desc, created_at desc").Find(&transaction, &db.Transaction{
//Type: transactionType,
PaymentHash: paymentHash,
})
Expand Down

0 comments on commit 7773186

Please sign in to comment.