Skip to content

Commit

Permalink
fix: fix attempting to validate faux transaction (#3758)
Browse files Browse the repository at this point in the history
Description
---
Found a panic where the tx validation will try validate a faux transaction and then panic when it doesn’t have a kernel to display.

Filtered out Imported transactions and fixed the unwrap to be handled gracefully.
  • Loading branch information
philipr-za authored Jan 26, 2022
1 parent 44aa3bc commit 7de1b23
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ where
.kernels()
.first()
.map(|k| k.excess.to_hex())
.unwrap(),
.unwrap_or_else(|| "{No Kernel found}".to_string()),
self.operation_id
);
self.update_transaction_as_unmined(last_mined_transaction.tx_id, &last_mined_transaction.status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ impl TransactionBackend for TransactionServiceSqliteDatabase {
let acquire_lock = start.elapsed();
let tx = completed_transactions::table
.filter(completed_transactions::mined_height.is_not_null())
.filter(completed_transactions::mined_height.gt(0))
.order_by(completed_transactions::mined_height.desc())
.first::<CompletedTransactionSql>(&*conn)
.optional()?;
Expand Down

0 comments on commit 7de1b23

Please sign in to comment.