Skip to content

Commit 0d9e8eb

Browse files
committed
Eliminate redundant subscription logging and move it to debug.
1 parent 6c7b550 commit 0d9e8eb

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/subscribe_manager.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ void subscribe_manager::post(const payment_address& address, size_t height,
273273
BITCOIN_ASSERT(serial.iterator() == data.begin() + info_size);
274274
DEBUG_ONLY(auto rawtx_end_it =) satoshi_save(tx, serial.iterator());
275275
BITCOIN_ASSERT(rawtx_end_it == data.end());
276+
auto matched = false;
276277

277278
// Send the result to everyone interested.
278279
for (const auto& subscription: subscriptions_)
@@ -284,14 +285,16 @@ void subscribe_manager::post(const payment_address& address, size_t height,
284285
if (match != subscription.prefix)
285286
continue;
286287

287-
log_info(LOG_SERVICE)
288-
<< "Subscribed address: " << address.encoded() << " found in tx ["
289-
<< encode_hash(hash_transaction(tx)) << "]";
290-
288+
matched = true;
291289
const auto& origin = subscription.client_origin;
292290
outgoing_message update(origin, "address.update", data);
293291
subscription.queue_send(update);
294292
}
293+
294+
if (matched)
295+
log_debug(LOG_SERVICE)
296+
<< "Subscribed address: " << address.encoded() << " found in tx ["
297+
<< encode_hash(hash_transaction(tx)) << "]";
295298
}
296299

297300
void subscribe_manager::post(const binary_type& prefix, size_t height,
@@ -316,6 +319,7 @@ void subscribe_manager::post(const binary_type& prefix, size_t height,
316319
BITCOIN_ASSERT(serial.iterator() == data.begin() + info_size);
317320
DEBUG_ONLY(auto rawtx_end_it =) satoshi_save(tx, serial.iterator());
318321
BITCOIN_ASSERT(rawtx_end_it == data.end());
322+
auto matched = false;
319323

320324
// Send the result to everyone interested.
321325
for (const auto& subscription: subscriptions_)
@@ -327,14 +331,16 @@ void subscribe_manager::post(const binary_type& prefix, size_t height,
327331
if (match != subscription.prefix)
328332
continue;
329333

330-
log_info(LOG_SERVICE)
331-
<< "Subscribed stealth prefix found in tx ["
332-
<< encode_hash(hash_transaction(tx)) << "]";
333-
334+
matched = true;
334335
const auto& origin = subscription.client_origin;
335336
outgoing_message update(origin, "address.stealth_update", data);
336337
subscription.queue_send(update);
337338
}
339+
340+
if (matched)
341+
log_debug(LOG_SERVICE)
342+
<< "Subscribed stealth prefix found in tx ["
343+
<< encode_hash(hash_transaction(tx)) << "]";
338344
}
339345

340346
void subscribe_manager::sweep_expired()

0 commit comments

Comments
 (0)