HomePhabricator

rpc: require second argument only for scantxoutset start action

Description

rpc: require second argument only for scantxoutset start action

Summary:

The second argument of scanobjects is only required for the start action. Stop and abort actions did not and could work without them.

It appears that this was broken by #16240 which enforced the size of the arguments to match the listed required arguments.

To fix this issue, this PR makes the scanobjects argument an optional argument. Then only in the start action do we check whether the scanobjects argument is there and throw an informative error about that. Also a test is added for this case.

This is a backport of Core PR17728

Test Plan:
ninja && ./test/functional/test_runner.py rpc_scantxoutset

In one terminal window, run:
bitcoin-cli scantxoutset start "[\"addr(1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2)\"]"

In another terminal, check that the two following commands work:

bitcoin-cli scantxoutset status
bitcoin-cli scantxoutset abort

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D8324

Details

Provenance
Andrew Chow <achow101-github@achow101.com>Authored on Nov 9 2020, 14:30
PiRKCommitted on Nov 9 2020, 14:31
abc-botPushed on Nov 9 2020, 14:36
Reviewer
Restricted Project
Differential Revision
D8324: rpc: require second argument only for scantxoutset start action
Parents
rABC0f17907934bf: Templatize ValidationState instead of subclassing
Branches
Unknown
Tags
Unknown