lookahead optimization for users that disabled subaddresses (#220)
What changed, and why it matters
This is a small performance optimization. When a user has disabled subaddresses, the scanner now skips a step that pre-generates future subaddress keys. This makes servers with subaddresses disabled run faster. There is no security problem visible in the change.
No security action needed. Treat as a normal performance improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds an early return in update_lookahead() when match.is_zero() is true, which corresponds to the disabled-subaddress case. This avoids unnecessary lookahead work for accounts that do not use subaddresses. The change is purely an optimization and does not alter cryptographic handling, validation, or access control.
Changed components
src/scanner.cppInspect captured patch +3 / −0
diff --git a/src/scanner.cpp b/src/scanner.cpp
index b416071..95b6586 100644
--- a/src/scanner.cpp
+++ b/src/scanner.cpp
@@ -315,6 +315,9 @@ namespace lws
void update_lookahead(const account& user, subaddress_reader& reader, const db::address_index& match, const db::block_id height)
{
+ if (match.is_zero())
+ return; // keep subaddress disabled servers quick
+
if (!reader.disk)
throw std::runtime_error{"Bad DB handle in scanner"};
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.