Skip to content

rpc, test: Fix JSON parsing errors in unloadwallet and getdescriptoractivity RPCs #118

@kevkevinpal

Description

@kevkevinpal

mentioned in: bitcoin#32845

"Thanks for the follow-up. The current fix is wrong. Looking at the original getdescriptoractivity implementation PR samples and tests, also checking the logic in the RPC, the second array, descriptors, has to be provided. Now, the first one, blockhashes, could be empty and activities may be returned in result if there are any in the mempool (3rd parameter include_mempool is true by default, but if the user sets it to false, the RPC is still usable -> no errors, just empty activity array will be returned).

As explained above, calling getdescriptoractivity with both blockhashes and descriptors arrays being empty doesn't make sense because it won't produce any results (but won't raise any errors), what's actually essential to be present in the call is the descriptors array, 2nd param, which will be used to filter the blocks and only if any is found will be added into the results.

So, I think, the error should say: "Both blockhashes and descriptors arrays must be specified", and the .empty() check should be removed for both. If we want to be more specific could check only for the emptiness of descriptors and will have to change the error message accordingly." - pablomartin4btc

Metadata

Metadata

Assignees

No one assigned

    Labels

    followupThis is a possible follow-up someone can work onneed to confirmNeed to confirm if this is still needed or already done

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions