Skip to content

Conversation

jnewbery
Copy link
Contributor

Removes wallet access to -limitancestorcount, -limitdescendantcount and -prune:

  • -limitancestorcount and -limitdescendantcount are now accessed with a method getPackageLimits in the Chain interface.
  • -prune is not required. It was only used in wallet component initiation to prevent running -rescan when pruning was enabled. This check is not required.

Partially addresses #17137.

The wallet should not be able to directly access global configuration
from the node. Remove access of "-limitancestorcount" and
"-limitdescendantcount".
Prior to this PR, the wallet would not allow the `-rescan` option at
startup if pruning was enabled. This is unnecessarily restrictive. It
should be possible to rescan if pruning is enabled, as long as no blocks
have actually been pruned yet.

Remove the pruning check from WalletInit::ParameterInteraction(). If any
blocks have been pruned, that will be caught in CreateWalletFromFile().
@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #17127 (util: Correct permissions for datadir and wallets subdir by hebasto)
  • #16659 (refactoring: Remove unused includes by practicalswift)
  • #16224 (gui: Bilingual GUI error messages by hebasto)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@practicalswift
Copy link
Contributor

Concept ACK

Thanks for working on this!

@laanwj
Copy link
Member

laanwj commented Oct 15, 2019

Concept ACK

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK b96ed03

@@ -122,8 +122,6 @@ bool WalletInit::ParameterInteraction() const

if (gArgs.GetBoolArg("-sysperms", false))
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false))
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.").translated);
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a pretty user friendly error message that might be better to keep.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with commit description, which is in line with #16037.

Side note, there was no test for this 😞

Copy link

Choose a reason for hiding this comment

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

I think this error message is wrong. You can rescan in pruned mode if rescan height is in range of non-pruned blocks. It's really likely it's going to fail if wallet has been disabled for a long time but not sure. Maybe a warning?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with commit description, which is in line with #16037.

Oops, I hadn't seen the commit description. I see the message in CreateWalletFile keeps the suggestion to use -reindex, so this looks good to me.

@maflcko maflcko changed the title Remove wallet access to some node arguments refactor: Remove wallet access to some node arguments Oct 15, 2019
@maflcko maflcko changed the title refactor: Remove wallet access to some node arguments Remove wallet access to some node arguments Oct 15, 2019
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

Code review ACK b96ed03.

@@ -122,8 +122,6 @@ bool WalletInit::ParameterInteraction() const

if (gArgs.GetBoolArg("-sysperms", false))
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false))
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.").translated);
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with commit description, which is in line with #16037.

Side note, there was no test for this 😞

Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

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

ACK b96ed03, check there isn't left anymore wallet access to node arguments.

@@ -122,8 +122,6 @@ bool WalletInit::ParameterInteraction() const

if (gArgs.GetBoolArg("-sysperms", false))
return InitError("-sysperms is not allowed in combination with enabled wallet functionality");
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false))
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.").translated);
Copy link

Choose a reason for hiding this comment

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

I think this error message is wrong. You can rescan in pruned mode if rescan height is in range of non-pruned blocks. It's really likely it's going to fail if wallet has been disabled for a long time but not sure. Maybe a warning?

@maflcko
Copy link
Member

maflcko commented Oct 15, 2019

Before (master) always showing an error:

Screenshot from 2019-10-15 14-46-47

After (this pull) either doing a rescan or showing an error:

Screenshot from 2019-10-15 14-49-56
Screenshot from 2019-10-15 14-53-16

Tested ACK b96ed03

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Tested ACK b96ed0396294fc4fa89d83ceab6bc169dd09f002
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhSaAv/aA1uM2rqWt+jTHUWQOVRX+wJC9Mj1fnJr4YE7FS9zcSVepfET22JsZVg
i8aN3DZnKJZioh4MpWqTQokOIChWl0FMsLEWrNfjb4w+8Mc4ngemGeo8jnNVP9+H
CZv+ZE4xLfVztUx/mrRQQIaXcgKLhgL4lgEPhbuEwa7/3WpHVGFO4nugyLTAprvQ
mNMd4ZFjXCXGomyDurtX9wSantZyhHYzPPWjIAc1DrvLRbVIR0fUssWSeGz+2Sks
bZ6l8IML1Lx5IcaOZz3tjWx1ZGcw132LQrELfmU7NccGADo6b3W/hpoYb9Fbs9H4
4tchOhdi+RMBTMRcKVBt4RnG8Z5xQbgpUEYWjHrbuq0N3F5tewa8DbffLN9dNO+s
iUZB/J/++6iKKB0JQLh8BMQ7W1WXCCL5gBK60DCCMOa48vISwxyjTcehoeUq9r/n
5bzbB5ECWNBEBeZkA4t9SwGpVBMlfU2tExAudncLIL4XRvPCR6NGyAg2YYHb4vb1
8bDj7sd6
=mR0T
-----END PGP SIGNATURE-----

Timestamp of file with hash 7fc406744b9a7b419ca0b002011cb8b2f67acde9d3060b2717e11fe44257c7dd -

@maflcko
Copy link
Member

maflcko commented Oct 15, 2019

To put it into context, this pull is doing for command line args, what has already been done for the rpc, see #15870

maflcko pushed a commit that referenced this pull request Oct 15, 2019
b96ed03 [wallet] Remove pruning check for -rescan option (John Newbery)
eea462d [wallet] Remove package limit config access from wallet (John Newbery)

Pull request description:

  Removes wallet access to `-limitancestorcount`, `-limitdescendantcount` and `-prune`:

  - `-limitancestorcount` and `-limitdescendantcount` are now accessed with a method `getPackageLimits` in the `Chain` interface.
  - `-prune` is not required. It was only used in wallet component initiation to prevent running `-rescan` when pruning was enabled. This check is not required.

  Partially addresses #17137.

ACKs for top commit:
  MarcoFalke:
    Tested ACK b96ed03
  ryanofsky:
    Code review ACK b96ed03
  promag:
    Code review ACK b96ed03.
  ariard:
    ACK b96ed03, check there isn't left anymore wallet access to node arguments.

Tree-SHA512: 90c8e3e083acbd37724f1bccf63dab642cf9ae95cc5e684872a67443ae048b4fdbf57b52ea47c5a1da6489fd277278fe2d9bbe95e17f3d4965a1a0fbdeb815bf
@maflcko maflcko merged commit b96ed03 into bitcoin:master Oct 15, 2019
@jnewbery jnewbery deleted the 2019-10-remove-wallet-access-to-node-args branch October 15, 2019 19:09
@sipa
Copy link
Member

sipa commented Oct 15, 2019

What a weird language you're testing things with, @MarcoFalke.

MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Nov 17, 2019
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 31, 2020
…wallet

Summary:
The wallet should not be able to directly access global configuration
from the node. Remove access of "-limitancestorcount" and
"-limitdescendantcount".

bitcoin/bitcoin@eea462d

---

Partial backport of Core [[bitcoin/bitcoin#17138 | PR17138]]

Test Plan:
  ninja check check-functional

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D7090
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 31, 2020
Summary:
Prior to this PR, the wallet would not allow the `-rescan` option at
startup if pruning was enabled. This is unnecessarily restrictive. It
should be possible to rescan if pruning is enabled, as long as no blocks
have actually been pruned yet.

Remove the pruning check from WalletInit::ParameterInteraction(). If any
blocks have been pruned, that will be caught in CreateWalletFromFile().

bitcoin/bitcoin@b96ed03

---

Depends on D7090

Concludes backport of Core [[bitcoin/bitcoin#17138 | PR17138]]

Test Plan:
  ninja check check-functional

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D7091
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants