Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Report exception failure in logging and response
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jan 4, 2021
1 parent 9d20bc9 commit a7a9fe4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,23 +458,28 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin

return [this, &trx, &chain, &next](const fc::static_variant<fc::exception_ptr, transaction_trace_ptr>& response) {
next(response);
if (response.contains<fc::exception_ptr>() || response.get<transaction_trace_ptr>()->except) {
_transaction_ack_channel.publish(priority::low, std::pair<fc::exception_ptr, transaction_metadata_ptr>(response.get<fc::exception_ptr>(), trx));

fc::exception_ptr except_ptr;
if (response.contains<fc::exception_ptr>()) {
except_ptr = response.get<fc::exception_ptr>();
} else if (response.get<transaction_trace_ptr>()->except) {
except_ptr = response.get<transaction_trace_ptr>()->except->dynamic_copy_exception();
}
_transaction_ack_channel.publish(priority::low, std::pair<fc::exception_ptr, transaction_metadata_ptr>(except_ptr, trx));

if (except_ptr) {
if (_pending_block_mode == pending_block_mode::producing) {
fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is REJECTING tx: ${txid} : ${why} ",
("block_num", chain.head_block_num() + 1)
("prod", get_pending_block_producer())
("txid", trx->id())
("why", response.contains<fc::exception_ptr>() ?
response.get<fc::exception_ptr>()->what() : response.get<transaction_trace_ptr>()->except->what()));
("why", except_ptr->what()));
} else {
fc_dlog(_trx_failed_trace_log, "[TRX_TRACE] Speculative execution is REJECTING tx: ${txid} : ${why} ",
("txid", trx->id())
("why", response.contains<fc::exception_ptr>() ?
response.get<fc::exception_ptr>()->what() : response.get<transaction_trace_ptr>()->except->what()));
("why", except_ptr->what()));
}
} else {
_transaction_ack_channel.publish(priority::low, std::pair<fc::exception_ptr, transaction_metadata_ptr>(nullptr, trx));
if (_pending_block_mode == pending_block_mode::producing) {
fc_dlog(_trx_successful_trace_log, "[TRX_TRACE] Block ${block_num} for producer ${prod} is ACCEPTING tx: ${txid}",
("block_num", chain.head_block_num() + 1)
Expand Down

0 comments on commit a7a9fe4

Please sign in to comment.