Repository navigation
Conversation
Hard to know what a returned std::Expected(std::nullopt) mean if it is not documented anywhere.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. |
Clarifies when the index will be used, renames confusing `txospenderindex_ready` flag to `use_index`, and breaks up the nested if/else chain into documented sections.
498e0c4 to
e40535a
Compare
|
Did you see my suggested refactoring of the RPC? fjahr@a7b0e95 I just pulled this out of #34635 because it was controversial, see #34635 (comment). But I will reopen it as a standalone PR. EDIT: Put it here: #34749 |
Nope, I didn’t see it. Otherwise I would have ACKed the concept and left these changes there.
And dunno about the "controversial" argument. Will check your code, but this one at least is purely |
Thanks, please read #34635 (comment) to see why I pulled it out :) My version does a bit more than your refactoring. Let's see how we can converge on one improvement that everyone can agree on. |
Yeah absolutely, will do. |
|
Closing. Leaving it in @fjahr's hands. Let's continue on your PR. |
d236415 rpc: Refactor gettxspendingprevout to be easier to parse (Fabian Jahr) Pull request description: This refactoring commit was originally part of #34635 but the the change was some-what controversial: #34635 (comment) and the discussion was blocking the rest of the uncontroversial changes from moving forward. It looks like #34748 is trying to achieve something similar now, we'll have to see how the different approached converge but at least there seems to be some more conceptual interest than appeared on #34635 originally. ACKs for top commit: hodlinator: ACK d236415 sedited: Re-ACK d236415 furszy: utACK d236415 Tree-SHA512: 3df70bb8f143247f66d52430b3d8a4ecc5f0b80aa68ef3fc9082739b6f1be02fa9ef88ff134bb01034c9b6006400342e71fa8dc0a203d8e13b4bf6e21d1b05a8
This should help future ourselves and other devs to maintain the code. The code here
took me a bit to grasp, so I imagine others could be in the same situation.
First,
TxoSpenderIndex::FindSpenderreturns anExpected<optional<TxoSpender>>butthe two levels of the return type were undocumented, making it unclear what a returned
nulloptmeans. So added doc clarifying each return case.Second, the result-building loop in
gettxspendingprevoutwas not super readableto me, mainly due to the nested if/else chain and missing comments on what is going on
along the process.
Hope this helps others, if not, I can close it. It was helpful to me.