diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index 40a266b90d9..0d12a0ec1bc 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -458,21 +458,28 @@ class producer_plugin_impl : public std::enable_shared_from_this& response) { next(response); + + fc::exception_ptr except_ptr; if (response.contains()) { - _transaction_ack_channel.publish(priority::low, std::pair(response.get(), trx)); + except_ptr = response.get(); + } else if (response.get()->except) { + except_ptr = response.get()->except->dynamic_copy_exception(); + } + _transaction_ack_channel.publish(priority::low, std::pair(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.get()->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.get()->what())); + ("why", except_ptr->what())); } } else { - _transaction_ack_channel.publish(priority::low, std::pair(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) @@ -491,7 +498,8 @@ class producer_plugin_impl : public std::enable_shared_from_this next, - RetryLaterFunc retry_later) + RetryLaterFunc retry_later, + bool return_failure_trace = false) { bool exhausted = false; chain::controller& chain = chain_plug->chain(); @@ -546,8 +554,12 @@ class producer_plugin_impl : public std::enable_shared_from_thisexcept->dynamic_copy_exception(); - send_response( e_ptr ); + if( return_failure_trace ) { + send_response( trace ); + } else { + auto e_ptr = trace->except->dynamic_copy_exception(); + send_response( e_ptr ); + } } } else { if( persist_until_expired ) { @@ -2094,7 +2106,8 @@ bool producer_plugin::execute_incoming_transaction(const chain::transaction_meta }; const bool persist_until_expired = false; - bool exhausted = !my->process_incoming_transaction_async( trx, persist_until_expired, std::move(next), retry_later_func ); + const bool return_failure_trace = true; + bool exhausted = !my->process_incoming_transaction_async( trx, persist_until_expired, std::move(next), retry_later_func, return_failure_trace ); if( exhausted ) { if( my->_pending_block_mode == pending_block_mode::producing ) { my->schedule_maybe_produce_block( true );