File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
include/bitcoin/network/net Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ class BCT_API distributor
113
113
const system::data_chunk& data) NOEXCEPT
114
114
{
115
115
// Avoid deserialization if there are no subscribers for the type.
116
- if (!is_zero ( subscriber.size () ))
116
+ if (!subscriber.empty ( ))
117
117
{
118
118
// Subscribers are notified only with stop code or error::success.
119
119
const auto ptr = messages::deserialize<Message>(data, version);
Original file line number Diff line number Diff line change 23
23
#include < bitcoin/network/memory.hpp>
24
24
#include < bitcoin/network/messages/messages.hpp>
25
25
26
+ // Set false to use default block allocation.
27
+ constexpr bool use_block_allocator = true ;
28
+
26
29
namespace libbitcoin {
27
30
namespace network {
28
31
@@ -159,7 +162,10 @@ code distributor::do_notify<messages::block>(
159
162
distributor::block_subscriber& subscriber, uint32_t version,
160
163
const system::data_chunk& data) NOEXCEPT
161
164
{
162
- if (!is_zero (subscriber.size ()))
165
+ if (subscriber.empty ())
166
+ return error::success;
167
+
168
+ if constexpr (use_block_allocator)
163
169
{
164
170
const auto arena = memory_.get_arena ();
165
171
if (arena == nullptr )
@@ -170,9 +176,12 @@ code distributor::do_notify<messages::block>(
170
176
return error::invalid_message;
171
177
172
178
subscriber.notify (error::success, ptr);
179
+ return error::success;
180
+ }
181
+ else
182
+ {
183
+ return do_notify<messages::block>(subscriber, version, data);
173
184
}
174
-
175
- return error::success;
176
185
}
177
186
178
187
#undef SUBSCRIBER
You can’t perform that action at this time.
0 commit comments