diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 53923cc768..15a385aae9 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -75,7 +75,7 @@ class maybe_session { public: maybe_session() = default; - maybe_session( maybe_session&& other) + maybe_session( maybe_session&& other) noexcept :_session(std::move(other._session)) { } diff --git a/libraries/chain/fork_database.cpp b/libraries/chain/fork_database.cpp index 66421c1b6b..67057dece7 100644 --- a/libraries/chain/fork_database.cpp +++ b/libraries/chain/fork_database.cpp @@ -23,11 +23,6 @@ namespace eosio::chain { template const uint32_t fork_database::max_supported_version = 2; - // work around block_state_legacy::is_valid being private - inline bool block_state_is_valid( const block_state_legacy& bs ) { - return bs.is_valid(); - } - /** * History: * Version 1: initial version of the new refactored fork database portable format @@ -269,7 +264,7 @@ namespace eosio::chain { index.clear(); root = std::make_shared(); static_cast(*root) = root_bhs; - root->validated = true; + root->set_valid(true); head = root; } @@ -285,7 +280,7 @@ namespace eosio::chain { auto itr = by_id_idx.begin(); while (itr != by_id_idx.end()) { by_id_idx.modify( itr, [&]( bsp& _bsp ) { - _bsp->validated = false; + _bsp->set_valid(false); } ); ++itr; } @@ -565,7 +560,7 @@ namespace eosio::chain { template void fork_database_impl::mark_valid_impl( const bsp& h ) { - if( h->validated ) return; + if( h->is_valid() ) return; auto& by_id_idx = index.template get(); @@ -575,7 +570,7 @@ namespace eosio::chain { ("id", h->id()) ); by_id_idx.modify( itr, []( bsp& _bsp ) { - _bsp->validated = true; + _bsp->set_valid(true); } ); auto candidate = index.template get().begin(); diff --git a/libraries/chain/include/eosio/chain/block_state.hpp b/libraries/chain/include/eosio/chain/block_state.hpp index a7ed4ef903..6c98e1f2f1 100644 --- a/libraries/chain/include/eosio/chain/block_state.hpp +++ b/libraries/chain/include/eosio/chain/block_state.hpp @@ -26,16 +26,12 @@ namespace eosio::chain { uint32_t block_num() const { return block_header_state::block_num(); } block_timestamp_type timestamp() const { return block_header_state::timestamp(); } const extensions_type& header_extensions() const { return block_header_state::header.header_extensions; } + bool is_valid() const { return validated; } + void set_valid(bool b) { validated = b; } + uint32_t irreversible_blocknum() const { return 0; } // [greg todo] equivalent of dpos_irreversible_blocknum protocol_feature_activation_set_ptr get_activated_protocol_features() const { return block_header_state::activated_protocol_features; } deque extract_trxs_metas() { return {}; }; // [greg todo] see impl in block_state_legacy.hpp - - // [greg todo] equivalent of block_state_legacy_common::dpos_irreversible_blocknum - ref in fork_database.cpp - uint32_t irreversible_blocknum() const { return 0; } - - // [greg todo] equivalent of block_state_legacy::validated - ref in fork_database.cpp - bool is_valid() const { return validated; } - }; using block_state_ptr = std::shared_ptr; diff --git a/libraries/chain/include/eosio/chain/block_state_legacy.hpp b/libraries/chain/include/eosio/chain/block_state_legacy.hpp index 859f6bc3d0..a779e07124 100644 --- a/libraries/chain/include/eosio/chain/block_state_legacy.hpp +++ b/libraries/chain/include/eosio/chain/block_state_legacy.hpp @@ -37,16 +37,14 @@ namespace eosio { namespace chain { block_timestamp_type timestamp() const { return header.timestamp; } const extensions_type& header_extensions() const { return header.header_extensions; } bool is_valid() const { return validated; } - protocol_feature_activation_set_ptr get_activated_protocol_features() const { return activated_protocol_features; } + void set_valid(bool b) { validated = b; } + protocol_feature_activation_set_ptr get_activated_protocol_features() const { return activated_protocol_features; } + const deque& trxs_metas() const { return _cached_trxs; } + private: // internal use only, not thread safe friend struct fc::reflector; - friend bool block_state_is_valid( const block_state_legacy& ); // work-around for multi-index access friend struct controller_impl; - template friend class fork_database; - template friend struct fork_database_impl; - friend class unapplied_transaction_queue; - friend struct pending_state; friend struct completed_block; bool is_pub_keys_recovered()const { return _pub_keys_recovered; } @@ -61,7 +59,6 @@ namespace eosio { namespace chain { _pub_keys_recovered = keys_recovered; _cached_trxs = std::move( trxs_metas ); } - const deque& trxs_metas()const { return _cached_trxs; } bool validated = false;