Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RPC][Wallet] Deprecate internal account system #1731

Merged
merged 12 commits into from
Jul 9, 2020

Conversation

Fuzzbawls
Copy link
Collaborator

This is the combined upstream PRs necessary to finalize Stage 2 of removing the internal wallet 'account' system in favor of a new 'label' system as detailed in #1706.

With this, references to 'account' in RPC command output has either been changed to 'label' (where appropriate), marked as deprecated and slated for removal in v5.0, or hidden/disabled entirely unless using a specific startup argument (-deprecatedrpc=accounts)

The functional testing suite has also been updated to use the 'label' API, and only continue to use the old 'account' API to verify expected same results with newer counterpart RPC commands, if available.

@Fuzzbawls Fuzzbawls added this to the 4.2.0 milestone Jul 5, 2020
@Fuzzbawls Fuzzbawls self-assigned this Jul 5, 2020
@Fuzzbawls Fuzzbawls added this to In progress in Remove internal accounting system via automation Jul 5, 2020
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good PR. Concept and code ACK, with few nits/questions inlined.

src/rpc/client.cpp Outdated Show resolved Hide resolved
src/rpc/client.cpp Outdated Show resolved Hide resolved
src/wallet/wallet.h Outdated Show resolved Hide resolved
src/wallet/wallet.cpp Show resolved Hide resolved
src/wallet/rpcwallet.cpp Outdated Show resolved Hide resolved
src/rpc/client.cpp Outdated Show resolved Hide resolved
src/wallet/rpcwallet.cpp Outdated Show resolved Hide resolved
src/qt/paymentserver.cpp Show resolved Hide resolved
src/wallet/rpcwallet.cpp Outdated Show resolved Hide resolved
src/wallet/rpcwallet.cpp Outdated Show resolved Hide resolved
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 🚜 , solving the comments above, light ACK for me.

@furszy
Copy link

furszy commented Jul 7, 2020

rebase needed.

@Fuzzbawls
Copy link
Collaborator Author

rebased and addressed comments

src/wallet/rpcwallet.cpp Outdated Show resolved Hide resolved
These initially mirror the account functions, with the following
differences:

* These functions aren't DEPRECATED in the help
* Help mentions 'label' instead of accounts. In the language used,
labels are associated with addresses, instead of addresses associated
with labels. (unlike with accounts.)
* Labels have no balance
 * No balances in listlabels
 * listlabels has no minconf or watchonly argument
* Like in the GUI, labels can be set on any address, not just receiving
addreses
* Unlike accounts, labels can be deleted.
  Being unable to delete them is a common annoyance.
  Currently only by reassigning all addresses using `setlabel`, but an
  explicit call `deletelabel` which assigns all address to the default
  label may make sense.
Deprecate all accounts functionality and make it only accessible by
using `-deprecatedrpc=accounts`.

Accounts specific RPCs, account arguments, and account related results
all require the `-deprecatedrpc=accunts` startup option now in order to
see account things.
New optional input argument "addressFilter" allows the results to be
filtered so that only that address' transactions are shown
All functional tests that were using the, now deprecated, account API
have been switched over to the new label API. Testing of the account API
still exists in the `rpc_deprecated.py` script however, which has been
added to the list of tests to run.
This was preventing the `help` command from listing or returning help
information on newer commands.

# Node1's "from0" account balance should be just the doublespend:
assert_equal(self.nodes[1].getbalance("from0"), (1240 * 5))
assert_equal(self.nodes[1].getbalance(), 6250 + (1240 * 5))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use starting_balance instead of static 6250.

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 6238aa4

Remove internal accounting system automation moved this from In progress to Reviewer approved Jul 9, 2020
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor non-blocking thing in getaddressinfo. But it can be addressed in a subsequent PR.
Tested with and without -deprecatedrpc=accounts.
All good ACK 6238aa4

Comment on lines +135 to 138
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getaddressinfo ( \"address\" )\n"
"\nReturn information about the given PIVX address.\n"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already like this, but shouldn't the address be a required field? i.e.

if (request.fHelp || request.params.size() != 1)
    throw std::runtime_error(
        "getaddressinfo \"address\"\n"
        ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants