File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
include/bitcoin/network/net Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,11 @@ class BCT_API distributor
115
115
// Avoid deserialization if there are no subscribers for the type.
116
116
if (!subscriber.empty ())
117
117
{
118
- // Subscribers are notified only with stop code or error::success.
119
118
const auto ptr = messages::deserialize<Message>(data, version);
120
-
121
119
if (!ptr)
122
120
return error::invalid_message;
123
121
122
+ // Subscribers are notified only with stop code or error::success.
124
123
subscriber.notify (error::success, ptr);
125
124
}
126
125
Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ code distributor::do_notify<messages::block>(
165
165
distributor::block_subscriber& subscriber, uint32_t version,
166
166
const system::data_chunk& data) NOEXCEPT
167
167
{
168
+ // Avoid deserialization if there are no subscribers for the type.
168
169
if (subscriber.empty ())
169
170
return error::success;
170
171
@@ -183,9 +184,13 @@ code distributor::do_notify<messages::block>(
183
184
}
184
185
else
185
186
{
186
- return do_notify<messages::block>(subscriber, version, data);
187
- }
187
+ const auto ptr = messages::deserialize<messages::block>(data, version);
188
+ if (!ptr)
189
+ return error::invalid_message;
188
190
191
+ // Subscribers are notified only with stop code or error::success.
192
+ subscriber.notify (error::success, ptr);
193
+ }
189
194
}
190
195
191
196
BC_POP_WARNING ()
You can’t perform that action at this time.
0 commit comments