Skip to content

Commit

Permalink
Merge pull request #3 from serejkaaa512/feature/check_src_error
Browse files Browse the repository at this point in the history
added check of transactions src address for error transactions
  • Loading branch information
KappaShilaff authored Oct 27, 2023
2 parents f803e02 + 9fd1c77 commit fd8ef4f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,21 @@ async fn parse_kafka_transactions(
}

fn check_failed_transactions(config: &BufferedConsumerConfig, transaction: &Transaction) -> bool {
if config.save_failed_transactions_for_accounts.contains(
&MsgAddressInt::with_standart(None, 0, transaction.account_addr.clone())
.unwrap_or_default(),
) {
let src = transaction
.in_msg
.as_ref()
.and_then(|im_cell| im_cell.read_struct().ok())
.and_then(|in_msg| in_msg.src());

let account_addr =
MsgAddressInt::with_standart(None, 0, transaction.account_addr.clone()).unwrap_or_default();
if config
.save_failed_transactions_for_accounts
.contains(&account_addr)
|| src.map_or(false, |s| {
config.save_failed_transactions_for_accounts.contains(&s)
})
{
if let Some(exit_code) = get_exit_code(transaction) {
if exit_code > 0 {
return true;
Expand Down

0 comments on commit fd8ef4f

Please sign in to comment.