Skip to content

Commit

Permalink
Merge pull request #676 from evoskuil/master
Browse files Browse the repository at this point in the history
Comments, style.
  • Loading branch information
evoskuil authored Aug 21, 2024
2 parents a138508 + d08be20 commit 924dd6f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/bitcoin/node/block_arena.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace libbitcoin {
namespace node {

/// Thread UNSAFE linked-linear memory arena.
/// Thread UNSAFE detachable linked-linear memory arena.
class BCN_API block_arena final
: public arena
{
Expand Down
9 changes: 8 additions & 1 deletion include/bitcoin/node/full_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ namespace libbitcoin {
namespace node {

/// Thread safe.
/// WARNING: when full node is using block_memory controller, all shared block
/// components invalidate when the block destructs. Lifetime of the block is
/// assured for the extent of all methods below, however if a sub-object is
/// retained by shared_ptr, beyond method completion, a copy of the block
/// shared_ptr must also be be retained. Taking a block or sub-object copy is
/// insufficient, as copies are shallow (copy internal shared_ptr objects).
class BCN_API full_node
: public network::p2p
{
public:
using memory_controller = block_memory;
using store = node::store;
using query = node::query;
typedef std::shared_ptr<full_node> ptr;
Expand Down Expand Up @@ -166,10 +173,10 @@ class BCN_API full_node

// These are thread safe.
const configuration& config_;
memory_controller memory_;
query& query_;

// These are protected by strand.
block_memory memory_;
chaser_block chaser_block_;
chaser_header chaser_header_;
chaser_check chaser_check_;
Expand Down
1 change: 0 additions & 1 deletion include/bitcoin/node/sessions/attach.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class attach
network::channel::ptr create_channel(const network::socket::ptr& socket,
bool quiet) NOEXCEPT override
{
// This memory arena is NOT thread safe.
return std::make_shared<network::channel>(session::get_memory(),
network::session::log, socket, network::session::settings(),
network::session::create_key(), quiet);
Expand Down
3 changes: 1 addition & 2 deletions src/full_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ full_node::full_node(query& query, const configuration& configuration,
const logger& log) NOEXCEPT
: p2p(configuration.network, log),
config_(configuration),
memory_(config_.node.allocation_multiple, config_.network.threads),
query_(query),
memory_(configuration.node.allocation_multiple,
configuration.network.threads),
chaser_block_(*this),
chaser_header_(*this),
chaser_check_(*this),
Expand Down

0 comments on commit 924dd6f

Please sign in to comment.