re: #17905 (review)
Thanks again for the review!
I mean this:
Yes, I did understand the suggestion. I like having getNumBlocks implemented the same way as getHeaderTipHeight and getHeaderTipTime, and I like m_cached_num_blocks
being touched as few places as possible (initialized to -1 and updated only as needed) and not needing to interact with the more complicated constructor.
I also think this case is similar to #18160 where I am trying to avoid an unnecessary interface method call (in that case interfaces::Wallet::tryGetBalances
, in this case interfaces::Node::getNumBlocks
), because I see these calls as potentially costly (with #10102 requiring serializing arguments, sending them across a socket and optionally logging them to debug.log, waiting for reply on the socket, deserializing and optionally logging that), but I think you see them more like ordinary method calls.
If other reviewers agree with your suggestion, though, I’m ok with changing this. I don’t think it is very significant.
Meta point: When I leave comment on PRs I try be be explicit about (1) What my suggestion is (2) What the benefits of the suggestion are or underlying problem is.
Some reviewers are great at saying what they want but not why they want it, others are great at finding things that should be improved without being specific enough about what kind of change they want to see. In this case, I understand the suggestion but don’t understand what’s driving it. Readability, avoiding a potential bug, efficiency, or just style?