From 91c7912b62eabbf0d42bebf6ecdbba009d15f5f9 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 30 May 2019 10:22:18 -0500 Subject: [PATCH] Reference to shared_ptr can be invalidated by completion of push_transaction. Create a local copy of transaction_metadata shared_ptr to keep alive until end of scope. --- plugins/producer_plugin/producer_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index 044caa2757e..ab9f5c8aa91 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -1493,7 +1493,7 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block() { if( preprocess_deadline <= fc::time_point::now() ) exhausted = true; if( exhausted ) break; - const auto& trx = itr->second; + const transaction_metadata_ptr trx = itr->second; auto category = calculate_transaction_category(trx); if (category == tx_category::EXPIRED || (category == tx_category::UNEXPIRED_UNPERSISTED && _producers.empty()))