Skip to content

Commit

Permalink
feat(chain-ops): Log transaction response's error code on failed broa…
Browse files Browse the repository at this point in the history
…dcast.
  • Loading branch information
KirilMihaylov committed Sep 26, 2024
1 parent eb8377e commit dd3af8d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions chain-ops/src/task/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,21 @@ where
}

fn log_tx_response(source: &str, tx_code: TxCode, response: &TxResponse) {
if tx_code.is_ok() {
log_broadcast_with_source!(info![source](
hash = %response.txhash,
"Transaction broadcast successful.",
));
} else {
log_broadcast_with_source!(error![source](
hash = %response.txhash,
log = ?response.raw_log,
"Transaction broadcast failed!",
));
match tx_code {
TxCode::Ok => {
log_broadcast_with_source!(info![source](
hash = %response.txhash,
"Transaction broadcast successful.",
));
},
TxCode::Err(code) => {
log_broadcast_with_source!(error![source](
hash = %response.txhash,
log = ?response.raw_log,
code = %code,
"Transaction broadcast failed!",
));
},
}
}

Expand Down

0 comments on commit dd3af8d

Please sign in to comment.