Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion console/executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool executor::do_run()
logger(BN_NODE_INTERRUPT);

// Create node.
metadata_.configured.network.initialize();
metadata_.configured.network.manual.initialize();
node_ = std::make_shared<full_node>(query_, metadata_.configured, log_);

// Subscribe node.
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/channels/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class BCN_API channel
DELETE_COPY_MOVE_DESTRUCT(channel);

protected:
channel(const network::logger&, const network::socket::ptr&,
const node::configuration&, uint64_t=zero) NOEXCEPT
channel(const network::logger&, const network::socket::ptr&, uint64_t,
const node::configuration&) NOEXCEPT
{
}
};
Expand Down
11 changes: 5 additions & 6 deletions include/bitcoin/node/channels/channel_http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ class BCN_API channel_http
{
public:
typedef std::shared_ptr<node::channel_http> ptr;
using options_t = network::channel_http::options_t;

channel_http(const network::logger& log, const network::socket::ptr& socket,
const node::configuration& config, uint64_t identifier=zero,
const options_t& options={}) NOEXCEPT
: network::channel_http(log, socket, config.network, identifier, options),
node::channel(log, socket, config, identifier)
channel_http(const network::logger& log,
const network::socket::ptr& socket, uint64_t identifier,
const node::configuration& config, const options_t& options) NOEXCEPT
: network::channel_http(log, socket, identifier, config.network, options),
node::channel(log, socket, identifier, config)
{
}
};
Expand Down
11 changes: 6 additions & 5 deletions include/bitcoin/node/channels/channel_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ class BCN_API channel_peer
public:
typedef std::shared_ptr<node::channel_peer> ptr;

channel_peer(network::memory& memory, const network::logger& log,
const network::socket::ptr& socket, const node::configuration& config,
uint64_t identifier=zero) NOEXCEPT
: network::channel_peer(memory, log, socket, config.network, identifier),
node::channel(log, socket, config, identifier),
channel_peer(network::memory& allocator, const network::logger& log,
const network::socket::ptr& socket, uint64_t identifier,
const node::configuration& config, const options_t& options) NOEXCEPT
: network::channel_peer(allocator, log, socket, identifier,
config.network, options),
node::channel(log, socket, identifier, config),
announced_(config.node.announcement_cache)
{
}
Expand Down
9 changes: 4 additions & 5 deletions include/bitcoin/node/channels/channel_tcp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ class BCN_API channel_tcp
{
public:
typedef std::shared_ptr<node::channel_tcp> ptr;
using options_t = network::channel_tcp::options_t;

channel_tcp(const network::logger& log, const network::socket::ptr& socket,
const node::configuration& config, uint64_t identifier=zero,
const options_t& options={}) NOEXCEPT
: network::channel_tcp(log, socket, config.network, identifier, options),
node::channel(log, socket, config, identifier)
uint64_t identifier, const node::configuration& config,
const options_t& options) NOEXCEPT
: network::channel_tcp(log, socket, identifier, config.network, options),
node::channel(log, socket, identifier, config)
{
}
};
Expand Down
13 changes: 5 additions & 8 deletions include/bitcoin/node/channels/channel_ws.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ class BCN_API channel_ws
{
public:
typedef std::shared_ptr<node::channel_ws> ptr;
using options_t = network::channel_ws::options_t;

channel_ws(const network::logger& log,
const network::socket::ptr& socket,
const node::configuration& config, uint64_t identifier=zero,
const options_t& options={}) NOEXCEPT
: network::channel_ws(log, socket, config.network, identifier,
options),
node::channel(log, socket, config, identifier)
channel_ws(const network::logger& log, const network::socket::ptr& socket,
uint64_t identifier, const node::configuration& config,
const options_t& options) NOEXCEPT
: network::channel_ws(log, socket, identifier, config.network, options),
node::channel(log, socket, identifier, config)
{
}
};
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/chase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ enum class chase
/// Issued by 'session_outbound' and handled by 'block_in_31800'.
split,

/// Channels (all with work) directed to split work and stop (channel_t).
/// Channels (all with work) directed to split work and stop (peer_t).
/// Issued by 'session_outbound' and handled by 'block_in_31800'.
stall,

/// Channels (all with work) directed to drop work and stop (channel_t).
/// Channels (all with work) directed to drop work and stop (peer_t).
/// Issued by 'check' and handled by 'block_in_31800'.
purge,

Expand Down
2 changes: 1 addition & 1 deletion include/bitcoin/node/define.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ using object_key = uint64_t;
/// Event value types.
using count_t = size_t;
using height_t = size_t;
using channel_t = uint64_t;
using peer_t = uint64_t;
using object_t = object_key;
using header_t = database::header_link::integer;
using transaction_t = database::tx_link::integer;
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/protocols/protocol_block_in_31800.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class BCN_API protocol_block_in_31800

/// Manage work splitting.
bool is_idle() const NOEXCEPT override;
virtual void do_purge(channel_t) NOEXCEPT;
virtual void do_split(channel_t) NOEXCEPT;
virtual void do_purge(peer_t) NOEXCEPT;
virtual void do_split(peer_t) NOEXCEPT;
virtual void do_report(count_t count) NOEXCEPT;

/// Check incoming block message.
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/protocols/protocol_block_out_70012.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class BCN_API protocol_block_out_70012
const network::messages::peer::send_headers::cptr& message) NOEXCEPT;

private:
// This is protected by strand.
bool superseded_{};
// This is thread safe.
std::atomic_bool superseded_{};
};

} // namespace node
Expand Down
4 changes: 4 additions & 0 deletions include/bitcoin/node/protocols/protocol_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class BCN_API protocol_peer
: public network::protocol_peer,
public node::protocol
{
public:
// Replace base class channel_t (network::channel_peer).
using channel_t = node::channel_peer;

protected:
/// Constructors.
/// -----------------------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions include/bitcoin/node/sessions/session_peer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <memory>
#include <utility>
#include <bitcoin/node/channels/channel.hpp>
#include <bitcoin/node/channels/channels.hpp>
#include <bitcoin/node/define.hpp>
#include <bitcoin/node/protocols/protocols.hpp>
#include <bitcoin/node/sessions/session.hpp>
Expand All @@ -39,6 +39,7 @@ class session_peer
{
public:
typedef std::shared_ptr<session_peer<Session>> ptr;
using options_t = typename Session::options_t;
using channel_t = node::channel_peer;

/// Construct an instance.
Expand All @@ -60,8 +61,8 @@ class session_peer
BC_ASSERT(this->stranded());

const auto channel = std::make_shared<channel_t>(
this->get_memory(), this->log, socket, this->config(),
this->create_key());
this->get_memory(), this->log, socket, this->create_key(),
this->config(), this->options());

return std::static_pointer_cast<network::channel>(channel);
}
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/node/sessions/session_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class session_server
{
BC_ASSERT(stranded());

const auto channel = std::make_shared<channel_t>(log, socket, config(),
create_key(), options_);
const auto channel = std::make_shared<channel_t>(log, socket,
create_key(), config(), options_);

return std::static_pointer_cast<network::channel>(channel);
}
Expand Down
2 changes: 2 additions & 0 deletions include/bitcoin/node/sessions/session_tcp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef LIBBITCOIN_NODE_SESSIONS_SESSION_TCP_HPP
#define LIBBITCOIN_NODE_SESSIONS_SESSION_TCP_HPP

#include <bitcoin/node/channels/channels.hpp>
#include <bitcoin/node/define.hpp>
#include <bitcoin/node/sessions/session.hpp>

Expand All @@ -34,6 +35,7 @@ class BCN_API session_tcp
public:
typedef std::shared_ptr<session_tcp> ptr;
using options_t = network::session_tcp::options_t;
using channel_t = node::channel_tcp;

// (network::net&) cast due to full_node forward ref (inheritance hidden).
session_tcp(full_node& node, uint64_t identifier,
Expand Down
6 changes: 3 additions & 3 deletions include/bitcoin/node/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ class BCN_API settings
settings(system::chain::selection context, const embedded_pages& explore,
const embedded_pages& web) NOEXCEPT;

/// native RESTful block explorer (http/s, stateless html/json)
server::settings::html_server explore;

/// native admin web interface, isolated (http/s, stateless html)
server::settings::html_server web;

/// native RESTful block explorer (http/s, stateless html/json)
server::settings::html_server explore;

/// native websocket query interface (http/s->tcp/s, json, handshake)
network::settings::websocket_server socket{ "socket" };

Expand Down
4 changes: 2 additions & 2 deletions src/chasers/chaser_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ chaser_check::chaser_check(full_node& node) NOEXCEPT
: chaser(node),
maximum_concurrency_(node.config().node.maximum_concurrency_()),
maximum_height_(node.config().node.maximum_height_()),
connections_(node.config().network.outbound_connections),
connections_(node.config().network.outbound.connections),
allowed_deviation_(node.config().node.allowed_deviation)
{
}
Expand Down Expand Up @@ -518,7 +518,7 @@ size_t chaser_check::set_unassociated() NOEXCEPT
size_t chaser_check::get_inventory_size() const NOEXCEPT
{
// Either condition means blocks shouldn't be getting downloaded (yet).
const size_t peers = config().network.outbound_connections;
const size_t peers = config().network.outbound.connections;
if (is_zero(peers) || !is_current(false))
return zero;

Expand Down
Loading
Loading