diff --git a/include/bitcoin/node/chase.hpp b/include/bitcoin/node/chase.hpp index 3f5cbcb4..aea98cb3 100644 --- a/include/bitcoin/node/chase.hpp +++ b/include/bitcoin/node/chase.hpp @@ -88,17 +88,21 @@ enum class chase /// Issued by 'organize' and handled by 'validate' (disorgs candidates). disorganized, - /// Validation. + /// Check/Identify. /// ----------------------------------------------------------------------- /// A block has been downloaded, checked and stored (height_t). - /// Issued by 'block_in_31800' and handled by 'connect'. + /// Issued by 'block_in_31800' or 'populate' and handled by 'connect'. + /// Populate is bypassed for checkpoint/milestone blocks. checked, /// A downloaded block has failed check (header_t). /// Issued by 'block_in_31800' and handled by 'header'. unchecked, + /// Accept/Connect. + /// ----------------------------------------------------------------------- + /// A branch has become valid (height_t). /// Issued by 'validate' and handled by 'confirm'. valid, @@ -107,7 +111,7 @@ enum class chase /// Issued by 'validate' and handled by 'header'. unvalid, - /// Confirmation. + /// Confirm (block). /// ----------------------------------------------------------------------- /// A connected block has become confirmable (header_t). @@ -118,7 +122,7 @@ enum class chase /// Issued by 'confirm' and handled by 'header' (and 'block'). unconfirmable, - /// Confirmed Chain. + /// Confirm (chain). /// ----------------------------------------------------------------------- /// A confirmable block has been confirmed (header_t). diff --git a/include/bitcoin/node/chasers/chaser_organize.hpp b/include/bitcoin/node/chasers/chaser_organize.hpp index b89da30e..3f4114ff 100644 --- a/include/bitcoin/node/chasers/chaser_organize.hpp +++ b/include/bitcoin/node/chasers/chaser_organize.hpp @@ -42,8 +42,8 @@ class chaser_organize /// Initialize chaser state. virtual code start() NOEXCEPT; - /// Validate and organize next block in sequence relative to caller peer. - virtual void organize(const typename Block::cptr& block_ptr, + /// Validate and organize next Block in sequence relative to calling peer. + virtual void organize(const typename Block::cptr& block, organize_handler&& handler) NOEXCEPT; protected: @@ -54,7 +54,7 @@ class chaser_organize chain_state::ptr state; }; using block_tree = std::unordered_map; - using header_links = std::vector; + using header_links = std_vector; /// Protected constructor for abstract base. chaser_organize(full_node& node) NOEXCEPT; @@ -96,7 +96,7 @@ class chaser_organize event_value value) NOEXCEPT; /// Organize a discovered Block. - virtual void do_organize(typename Block::cptr block_ptr, + virtual void do_organize(typename Block::cptr block, const organize_handler& handler) NOEXCEPT; /// Reorganize following Block unconfirmability. @@ -136,7 +136,7 @@ class chaser_organize // ------------------------------------------------------------------------ // Store Block into logical tree cache. - void cache(const typename Block::cptr& block_ptr, + void cache(const typename Block::cptr& block, const chain_state::ptr& state) NOEXCEPT; // Obtain chain state for given previous hash, nullptr if not found. diff --git a/include/bitcoin/node/chasers/chaser_populate.hpp b/include/bitcoin/node/chasers/chaser_populate.hpp index 35212925..9d0d9e94 100644 --- a/include/bitcoin/node/chasers/chaser_populate.hpp +++ b/include/bitcoin/node/chasers/chaser_populate.hpp @@ -19,6 +19,9 @@ #ifndef LIBBITCOIN_NODE_CHASERS_CHASER_POPULATE_HPP #define LIBBITCOIN_NODE_CHASERS_CHASER_POPULATE_HPP +#include +#include +#include #include #include @@ -39,14 +42,23 @@ class BCN_API chaser_populate /// Initialize chaser state. code start() NOEXCEPT override; + /// Populate a candidate block for validation. + virtual void populate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height, + network::result_handler&& complete) NOEXCEPT; + protected: virtual bool handle_event(const code& ec, chase event_, event_value value) NOEXCEPT; - virtual void do_checked(height_t height) NOEXCEPT; + virtual void do_populate(const system::chain::block::cptr& block, + database::header_link::integer link, size_t height, + const network::result_handler& complete) NOEXCEPT; private: - // TODO: + // These are protected by strand. + network::threadpool threadpool_; + network::asio::strand independent_strand_; }; } // namespace node diff --git a/include/bitcoin/node/chasers/chaser_validate.hpp b/include/bitcoin/node/chasers/chaser_validate.hpp index 73417850..c34f3b61 100644 --- a/include/bitcoin/node/chasers/chaser_validate.hpp +++ b/include/bitcoin/node/chasers/chaser_validate.hpp @@ -20,6 +20,7 @@ #define LIBBITCOIN_NODE_CHASERS_CHASER_VALIDATE_HPP #include +#include #include #include @@ -39,12 +40,19 @@ class BCN_API chaser_validate code start() NOEXCEPT override; + /// Validate a populated candidate block. + virtual void validate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height) NOEXCEPT; + protected: typedef network::race_unity race; virtual bool handle_event(const code& ec, chase event_, event_value value) NOEXCEPT; + virtual void do_validate(const system::chain::block::cptr& block, + database::header_link::integer link, size_t height) NOEXCEPT; + virtual void do_regressed(height_t branch_point) NOEXCEPT; virtual void do_checked(height_t height) NOEXCEPT; virtual void do_bump(height_t height) NOEXCEPT; diff --git a/include/bitcoin/node/define.hpp b/include/bitcoin/node/define.hpp index d4f43249..55eef41d 100644 --- a/include/bitcoin/node/define.hpp +++ b/include/bitcoin/node/define.hpp @@ -74,32 +74,18 @@ using channel_t = uint64_t; using object_t = object_key; using header_t = database::header_link::integer; using transaction_t = database::tx_link::integer; -typedef system::chain::block::cptr block_t; -////typedef struct -////{ -//// size_t height; -//// database::header_link link; -//// system::chain::block::cptr block; -////} xblock_t; /// std::variant types must be distinct, and xcode size_t is neither uint32_t /// nor uint64_t, so this ensures we have the distinct set of necessary types. using event_value = iif, - std::variant, + std::variant, iif, - std::variant, - std::variant>>; -////using xevent_value = -//// iif, -//// std::variant, -//// iif, -//// std::variant, -//// std::variant>>; + std::variant, + std::variant>>; /// Event desubscriber. typedef network::desubscriber event_subscriber; -////typedef network::desubscriber xevent_subscriber; typedef event_subscriber::handler event_notifier; typedef event_subscriber::completer event_completer; diff --git a/include/bitcoin/node/full_node.hpp b/include/bitcoin/node/full_node.hpp index a8788318..dc66fcc3 100644 --- a/include/bitcoin/node/full_node.hpp +++ b/include/bitcoin/node/full_node.hpp @@ -93,6 +93,18 @@ class BCN_API full_node /// Unsubscribe from chaser events. virtual void unsubscribe_events(object_key key) NOEXCEPT; + /// Blocks. + /// ----------------------------------------------------------------------- + + /// Populate a candidate block for validation. + virtual void populate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height, + network::result_handler&& complete) NOEXCEPT; + + /// Validate a populated candidate block. + virtual void validate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height) NOEXCEPT; + /// Suspensions. /// ----------------------------------------------------------------------- @@ -156,6 +168,7 @@ class BCN_API full_node chaser_block chaser_block_; chaser_header chaser_header_; chaser_check chaser_check_; + ////chaser_populate chaser_populate_; chaser_validate chaser_validate_; chaser_confirm chaser_confirm_; chaser_transaction chaser_transaction_; diff --git a/include/bitcoin/node/impl/chasers/chaser_organize.ipp b/include/bitcoin/node/impl/chasers/chaser_organize.ipp index 6a25240e..4f354e2e 100644 --- a/include/bitcoin/node/impl/chasers/chaser_organize.ipp +++ b/include/bitcoin/node/impl/chasers/chaser_organize.ipp @@ -69,13 +69,13 @@ code CLASS::start() NOEXCEPT } TEMPLATE -void CLASS::organize(const typename Block::cptr& block_ptr, +void CLASS::organize(const typename Block::cptr& block, organize_handler&& handler) NOEXCEPT { if (closed()) return; - POST(do_organize, block_ptr, std::move(handler)); + POST(do_organize, block, std::move(handler)); } // Methods @@ -114,14 +114,14 @@ bool CLASS::handle_event(const code&, chase event_, event_value value) NOEXCEPT } TEMPLATE -void CLASS::do_organize(typename Block::cptr block_ptr, +void CLASS::do_organize(typename Block::cptr block, const organize_handler& handler) NOEXCEPT { using namespace system; BC_ASSERT(stranded()); - const auto& hash = block_ptr->get_hash(); - const auto& header = get_header(*block_ptr); + const auto& hash = block->get_hash(); + const auto& header = get_header(*block); auto& query = archive(); // Skip existing/orphan, get state. @@ -174,7 +174,7 @@ void CLASS::do_organize(typename Block::cptr block_ptr, // Headers are late validated, with malleations ignored upon download. // Blocks are fully validated (not confirmed), so malleation is non-issue. - if ((ec = validate(*block_ptr, *state))) + if ((ec = validate(*block, *state))) { handler(ec, height); return; @@ -184,7 +184,7 @@ void CLASS::do_organize(typename Block::cptr block_ptr, if (!is_storable(*state)) { log_state_change(*parent, *state); - cache(block_ptr, state); + cache(block, state); handler(error::success, height); return; } @@ -215,7 +215,7 @@ void CLASS::do_organize(typename Block::cptr block_ptr, if (!strong) { log_state_change(*parent, *state); - cache(block_ptr, state); + cache(block, state); handler(error::success, height); return; } @@ -283,7 +283,7 @@ void CLASS::do_organize(typename Block::cptr block_ptr, // Push new header as top of candidate chain. { - if ((ec = push_block(*block_ptr, state->context()))) + if ((ec = push_block(*block, state->context()))) { handler(fault(ec), height); return; @@ -368,18 +368,18 @@ void CLASS::do_disorganize(header_t link) NOEXCEPT // ........................................................................ // Forward order is required to advance chain state for tree. - typename Block::cptr block_ptr{}; + typename Block::cptr block{}; for (auto index = add1(fork_point); index < height; ++index) { - if (!get_block(block_ptr, index)) + if (!get_block(block, index)) { fault(error::get_block); return; } - const auto& header = get_header(*block_ptr); + const auto& header = get_header(*block); state.reset(new chain::chain_state{ *state, header, settings_ }); - cache(block_ptr, state); + cache(block, state); } // Pop candidates from top candidate down to above fork point. @@ -439,10 +439,10 @@ void CLASS::do_disorganize(header_t link) NOEXCEPT // ---------------------------------------------------------------------------- TEMPLATE -void CLASS::cache(const typename Block::cptr& block_ptr, +void CLASS::cache(const typename Block::cptr& block, const chain_state::ptr& state) NOEXCEPT { - tree_.insert({ block_ptr->hash(), { block_ptr, state } }); + tree_.insert({ block->hash(), { block, state } }); } TEMPLATE diff --git a/include/bitcoin/node/protocols/protocol.hpp b/include/bitcoin/node/protocols/protocol.hpp index 4de6d68c..edd83550 100644 --- a/include/bitcoin/node/protocols/protocol.hpp +++ b/include/bitcoin/node/protocols/protocol.hpp @@ -20,6 +20,7 @@ #define LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_HPP // Individual session.hpp inclusion to prevent cycle (can't forward declare). +#include #include #include #include @@ -96,6 +97,18 @@ class BCN_API protocol /// Get the subscription key (for notify_one). virtual object_key events_key() const NOEXCEPT; + /// Blocks. + /// ----------------------------------------------------------------------- + + /// Populate a candidate block for validation. + virtual void populate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height, + network::result_handler&& complete) NOEXCEPT; + + /// Validate a populated candidate block. + virtual void validate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height) NOEXCEPT; + /// Properties. /// ----------------------------------------------------------------------- diff --git a/include/bitcoin/node/protocols/protocol_block_in_31800.hpp b/include/bitcoin/node/protocols/protocol_block_in_31800.hpp index c471471e..7ce1ab42 100644 --- a/include/bitcoin/node/protocols/protocol_block_in_31800.hpp +++ b/include/bitcoin/node/protocols/protocol_block_in_31800.hpp @@ -76,6 +76,10 @@ class BCN_API protocol_block_in_31800 private: using type_id = network::messages::inventory::type_id; + // HACK + void complete(const code& ec, const system::chain::block::cptr& block, + size_t height) const NOEXCEPT; + code check(const system::chain::block& block, const system::chain::context& ctx, bool bypass) const NOEXCEPT; @@ -97,6 +101,8 @@ class BCN_API protocol_block_in_31800 // These are protected by strand. map_ptr map_; job::ptr job_{}; + + std_vector blocks_{}; }; } // namespace node diff --git a/include/bitcoin/node/sessions/session.hpp b/include/bitcoin/node/sessions/session.hpp index 7292e482..b2fe19b7 100644 --- a/include/bitcoin/node/sessions/session.hpp +++ b/include/bitcoin/node/sessions/session.hpp @@ -20,6 +20,7 @@ #define LIBBITCOIN_NODE_SESSIONS_SESSION_HPP #include +#include #include #include #include @@ -73,6 +74,18 @@ class BCN_API session /// Unsubscribe from chaser events. virtual void unsubscribe_events(object_key key) NOEXCEPT; + /// Blocks. + /// ----------------------------------------------------------------------- + + /// Populate a candidate block for validation. + virtual void populate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height, + network::result_handler&& complete) NOEXCEPT; + + /// Validate a populated candidate block. + virtual void validate(const system::chain::block::cptr& block, + const database::header_link& link, size_t height) NOEXCEPT; + /// Methods. /// ----------------------------------------------------------------------- diff --git a/src/chasers/chaser_confirm.cpp b/src/chasers/chaser_confirm.cpp index 7b333899..9fb4b147 100644 --- a/src/chasers/chaser_confirm.cpp +++ b/src/chasers/chaser_confirm.cpp @@ -287,8 +287,7 @@ bool chaser_confirm::enqueue_block(const header_link& link) NOEXCEPT for (auto tx = std::next(txs.begin()); tx != txs.end(); ++tx) boost::asio::post(threadpool_.service(), - std::bind(&chaser_confirm::confirm_tx, - this, ctx, *tx, racer)); + BIND(confirm_tx, ctx, *tx, racer)); return true; } diff --git a/src/chasers/chaser_populate.cpp b/src/chasers/chaser_populate.cpp index b790ec9f..5c1fefeb 100644 --- a/src/chasers/chaser_populate.cpp +++ b/src/chasers/chaser_populate.cpp @@ -18,6 +18,8 @@ */ #include +#include +#include #include #include #include @@ -28,19 +30,17 @@ namespace node { #define CLASS chaser_populate -////using namespace system; -////using namespace system::chain; -////using namespace database; -////using namespace network; +using namespace system; +using namespace system::chain; +using namespace database; using namespace std::placeholders; -////// Shared pointers required for lifetime in handler parameters. -////BC_PUSH_WARNING(NO_VALUE_OR_CONST_REF_SHARED_PTR) -////BC_PUSH_WARNING(SMART_PTR_NOT_NEEDED) -////BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT) +BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT) chaser_populate::chaser_populate(full_node& node) NOEXCEPT - : chaser(node) + : chaser(node), + threadpool_(std::max(node.config().node.threads, 1_u32)), + independent_strand_(threadpool_.service().get_executor()) { } @@ -61,11 +61,6 @@ bool chaser_populate::handle_event(const code&, chase event_, switch (event_) { - case chase::checked: - { - POST(do_checked, height_t{}); - break; - } case chase::stop: { return false; @@ -79,14 +74,44 @@ bool chaser_populate::handle_event(const code&, chase event_, return true; } -void chaser_populate::do_checked(height_t) NOEXCEPT +// populate +// ---------------------------------------------------------------------------- + +// Could also pass ctx. +void chaser_populate::populate(const block::cptr& block, + const header_link& link, size_t height, + network::result_handler&& complete) NOEXCEPT { - BC_ASSERT(stranded()); + if (closed()) + return; + + // Unordered, but we may prefer to first populate from cache :|. + /*bool*/ ////archive().populate(*block); + + boost::asio::post(independent_strand_, + BIND(do_populate, block, link, height, std::move(complete))); +} + +void chaser_populate::do_populate(const block::cptr& block, + header_link::integer link, size_t height, + const network::result_handler& complete) NOEXCEPT +{ + BC_ASSERT(independent_strand_.running_in_this_thread()); + + // Previous blocks may not be archived. + /*bool*/ ////archive().populate(*block); + + // Use all closure parameters to ensure they aren't optimized out. + if (block->is_valid() && is_nonzero(height) && + link != header_link::terminal) + { + // Sends notification and deletes captured block in creating strand. + // Notify coincident with delete ensures there is no cleanup backlog. + complete(error::success); + } } -////BC_POP_WARNING() -////BC_POP_WARNING() -////BC_POP_WARNING() +BC_POP_WARNING() } // namespace node } // namespace libbitcoin diff --git a/src/chasers/chaser_validate.cpp b/src/chasers/chaser_validate.cpp index fc240e2b..8cc86609 100644 --- a/src/chasers/chaser_validate.cpp +++ b/src/chasers/chaser_validate.cpp @@ -109,6 +109,28 @@ bool chaser_validate::handle_event(const code&, chase event_, return true; } +// validate +// ---------------------------------------------------------------------------- + +// Could also pass ctx. +void chaser_validate::validate(const chain::block::cptr& block, + const header_link& link, size_t height) NOEXCEPT +{ + if (closed()) + return; + + POST(do_validate, block, link, height); +} + +void chaser_validate::do_validate(const chain::block::cptr& block, + database::header_link::integer link, size_t height) NOEXCEPT +{ + BC_ASSERT(stranded()); + + if (block->is_valid() && link != header_link::terminal) + fire(events::block_validated, height); +} + // track downloaded in order (to validate) // ---------------------------------------------------------------------------- @@ -225,8 +247,7 @@ bool chaser_validate::enqueue_block(const header_link& link) NOEXCEPT for (auto tx = txs.begin(); !closed() && tx != txs.end(); ++tx) boost::asio::post(threadpool_.service(), - std::bind(&chaser_validate::validate_tx, - this, ctx, *tx, racer)); + BIND(validate_tx, ctx, *tx, racer)); return true; } diff --git a/src/full_node.cpp b/src/full_node.cpp index 17553810..4292adc9 100644 --- a/src/full_node.cpp +++ b/src/full_node.cpp @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include #include @@ -28,6 +30,7 @@ namespace libbitcoin { namespace node { using namespace system; +using namespace database; using namespace network; BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT) @@ -41,6 +44,7 @@ full_node::full_node(query& query, const configuration& configuration, chaser_block_(*this), chaser_header_(*this), chaser_check_(*this), + ////chaser_populate_(*this), chaser_validate_(*this), chaser_confirm_(*this), chaser_transaction_(*this), @@ -80,6 +84,7 @@ void full_node::do_start(const result_handler& handler) NOEXCEPT chaser_header_.stopping(ec); chaser_block_.stopping(ec); chaser_check_.stopping(ec); + ////chaser_populate_.stopping(ec); chaser_validate_.stopping(ec); chaser_confirm_.stopping(ec); chaser_transaction_.stopping(ec); @@ -93,6 +98,7 @@ void full_node::do_start(const result_handler& handler) NOEXCEPT chaser_header_.start() : chaser_block_.start()))) || ((ec = chaser_check_.start())) || + ////((ec = chaser_populate_.start())) || ((ec = chaser_validate_.start())) || ((ec = chaser_confirm_.start())) || ((ec = chaser_transaction_.start())) || @@ -251,6 +257,21 @@ object_key full_node::create_key() NOEXCEPT return keys_; } +// Blocks. +// ---------------------------------------------------------------------------- + +void full_node::populate(const chain::block::cptr&, const header_link&, size_t, + network::result_handler&&) NOEXCEPT +{ + ////chaser_populate_.populate(block, link, height, std::move(complete)); +} + +void full_node::validate(const chain::block::cptr& block, + const header_link& link, size_t height) NOEXCEPT +{ + chaser_validate_.validate(block, link, height); +} + // Suspensions. // ---------------------------------------------------------------------------- diff --git a/src/protocols/protocol.cpp b/src/protocols/protocol.cpp index 8d55cd38..df4c20de 100644 --- a/src/protocols/protocol.cpp +++ b/src/protocols/protocol.cpp @@ -18,6 +18,8 @@ */ #include +#include +#include #include #include #include @@ -27,6 +29,9 @@ namespace node { #define CLASS protocol +using namespace system; +using namespace system::chain; +using namespace database; using namespace network; using namespace std::placeholders; @@ -109,6 +114,21 @@ object_key protocol::events_key() const NOEXCEPT return key_; } +// Blocks. +// ---------------------------------------------------------------------------- + +void protocol::populate(const block::cptr& block, const header_link& link, + size_t height, network::result_handler&& complete) NOEXCEPT +{ + session_->populate(block, link, height, std::move(complete)); +} + +void protocol::validate(const block::cptr& block, const header_link& link, + size_t height) NOEXCEPT +{ + session_->validate(block, link, height); +} + // Methods. // ---------------------------------------------------------------------------- diff --git a/src/protocols/protocol_block_in_31800.cpp b/src/protocols/protocol_block_in_31800.cpp index 7a7b8d96..dd447699 100644 --- a/src/protocols/protocol_block_in_31800.cpp +++ b/src/protocols/protocol_block_in_31800.cpp @@ -269,6 +269,7 @@ get_data protocol_block_in_31800::create_get_data( // check block // ---------------------------------------------------------------------------- +// Messages are allocated in a thread of the channel and bool protocol_block_in_31800::handle_receive_block(const code& ec, const block::cptr message) NOEXCEPT { @@ -281,8 +282,8 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec, // ........................................................................ auto& query = archive(); - const auto& block_ptr = message->block_ptr; - const auto& hash = block_ptr->get_hash(); + const auto& block = message->block_ptr; + const auto& hash = block->get_hash(); const auto it = map_->find(hash); if (it == map_->end()) @@ -306,7 +307,7 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec, // only stored when a strong header has been stored, later to be found out // as invalid and not malleable. Stored invalidity prevents repeat // processing of the same invalid chain but is not logically necessary. - if (const auto code = check(*block_ptr, it->context, checked)) + if (const auto code = check(*block, it->context, checked)) { // These imply that we don't have actual block represented by the hash. if (code == system::error::invalid_transaction_commitment || @@ -339,8 +340,8 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec, // Commit block.txs. // ........................................................................ - const auto size = block_ptr->serialized_size(true); - const chain::transactions_cptr txs_ptr{ block_ptr->transactions_ptr() }; + const auto size = block->serialized_size(true); + const chain::transactions_cptr txs_ptr{ block->transactions_ptr() }; // This invokes set_strong when checked. if (const auto code = query.set_code(*txs_ptr, link, size, checked)) @@ -358,7 +359,9 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec, LOGP("Downloaded block [" << encode_hash(hash) << ":" << height << "] from [" << authority() << "]."); - notify(error::success, chase::checked, height); + // protocol bind captures self, keeping channel alive until closure delete. + ////populate(block, link, height, BIND(complete, _1, block, height)); + notify(ec, chase::checked, height); fire(events::block_archived, height); count(message->cached_size); @@ -372,6 +375,16 @@ bool protocol_block_in_31800::handle_receive_block(const code& ec, return true; } +void protocol_block_in_31800::complete(const code& ec, + const chain::block::cptr& block, size_t height) const NOEXCEPT +{ + if (block->is_valid()) + { + notify(ec, chase::checked, height); + fire(events::block_archived, height); + } +} + // Header state is checked by organize. code protocol_block_in_31800::check(const chain::block& block, const chain::context& ctx, bool bypass) const NOEXCEPT diff --git a/src/sessions/session.cpp b/src/sessions/session.cpp index b1c3d370..6a2711fd 100644 --- a/src/sessions/session.cpp +++ b/src/sessions/session.cpp @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include #include @@ -30,6 +32,7 @@ namespace node { #define CLASS session using namespace system::chain; +using namespace database; using namespace network; BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT) @@ -100,6 +103,21 @@ void session::unsubscribe_events(object_key key) NOEXCEPT node_.unsubscribe_events(key); } +// Blocks. +// ---------------------------------------------------------------------------- + +void session::populate(const block::cptr& block, const header_link& link, + size_t height, network::result_handler&& complete) NOEXCEPT +{ + node_.populate(block, link, height, std::move(complete)); +} + +void session::validate(const block::cptr& block, const header_link& link, + size_t height) NOEXCEPT +{ + node_.validate(block, link, height); +} + // Methods. // ----------------------------------------------------------------------------