diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index f7ecd885..9d8cee4f 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -549,17 +549,19 @@ void database::notify_changed_objects() if( _undo_db.enabled() ) { const auto& head_undo = _undo_db.head(); + + vector new_ids; new_ids.reserve(head_undo.new_ids.size()); + for( const auto& item : head_undo.new_ids ) new_ids.push_back(item); + vector changed_ids; changed_ids.reserve(head_undo.old_values.size()); for( const auto& item : head_undo.old_values ) changed_ids.push_back(item.first); - for( const auto& item : head_undo.new_ids ) changed_ids.push_back(item); - vector removed; - removed.reserve( head_undo.removed.size() ); - for( const auto& item : head_undo.removed ) - { - changed_ids.push_back( item.first ); - removed.emplace_back( item.second.get() ); - } + + vector removed; removed.reserve( head_undo.removed.size() ); + for( const auto& item : head_undo.removed ) removed.emplace_back( item.second.get() ); + + new_objects(new_ids); changed_objects(changed_ids); + removed_objects(removed); } } FC_CAPTURE_AND_RETHROW() } diff --git a/libraries/chain/include/graphene/chain/database.hpp b/libraries/chain/include/graphene/chain/database.hpp index 1b721253..47fd63b9 100644 --- a/libraries/chain/include/graphene/chain/database.hpp +++ b/libraries/chain/include/graphene/chain/database.hpp @@ -189,6 +189,12 @@ namespace graphene { namespace chain { */ fc::signal on_pending_transaction; + /** + * Emitted After a block has been applied and committed. The callback + * should not yield and should execute quickly. + */ + fc::signal&)> new_objects; + /** * Emitted After a block has been applied and committed. The callback * should not yield and should execute quickly.