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

feat: introduce wipewallettxes RPC and wipetxes command for dash-wallet tool #5451

Merged
merged 6 commits into from
Jun 27, 2023

Conversation

UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Jun 21, 2023

Issue being fixed or feature implemented

Given the hard fork that happened on testnet, there is now lots of the transactions that were made on the fork that is no longer valid. Some transactions could be relayed and mined again but some like coinjoin mixing won't be relayed because of 0 fee and transactions spending coinbases from the forked branch are no longer valid at all.

What was done?

Introduce wipewallettxes RPC and wipetxes command for dash-wallet tool to be able to get rid of some/all txes in the wallet.

How Has This Been Tested?

run tests, use rpc/command on testnet wallet

Breaking Changes

n/a

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@UdjinM6 UdjinM6 added this to the 20 milestone Jun 21, 2023
@UdjinM6 UdjinM6 added backport-candidate-22.0.x RPC Some notable changes to RPC params/behaviour/descriptions tests An enhancement or modification to the function or unit test suite labels Jun 21, 2023
@UdjinM6 UdjinM6 force-pushed the wipe_wallet_txes branch from 65a2e26 to d793d58 Compare June 21, 2023 15:22
@thephez
Copy link
Collaborator

thephez commented Jun 21, 2023

Thanks, this looks helpful! I'm wondering if something else like clear or reset could still be accurate but less permanent/scary sounding as "wipe". I'll use it either way though - not a big deal 🙂

image

@@ -31,6 +31,7 @@ static void SetupWalletToolArgs(ArgsManager& argsman)

// Hidden
argsman.AddArg("salvage", "Attempt to recover private keys from a corrupt wallet", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
argsman.AddArg("wipetxes", "Wipe all transactions from a wallet", ArgsManager::ALLOW_ANY, OptionsCategory::COMMANDS);
Copy link
Member

Choose a reason for hiding this comment

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

should this be hidden? (is it actually?)

Copy link
Author

@UdjinM6 UdjinM6 Jun 26, 2023

Choose a reason for hiding this comment

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

It's not and shouldn't be. It looks like we added "salvage" option in the wrong place 07a4d48#diff-0d04b20c6ef91f3f8e0ab7cf0e17dde5665b82e9c838f8ad94fc5bd488757d76R34 and then we failed to remove // Hidden 1253e6d#diff-0d04b20c6ef91f3f8e0ab7cf0e17dde5665b82e9c838f8ad94fc5bd488757d76R32.

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK for squash merge; one nit

@UdjinM6 UdjinM6 requested a review from ogabrielides June 26, 2023 20:08
Copy link
Collaborator

@ogabrielides ogabrielides left a comment

Choose a reason for hiding this comment

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

LGTM

@UdjinM6 UdjinM6 merged commit 78fa019 into dashpay:develop Jun 27, 2023
@UdjinM6 UdjinM6 deleted the wipe_wallet_txes branch June 27, 2023 18:51
UdjinM6 added a commit that referenced this pull request Jun 28, 2023
…e, avoid wasting cpu cycles in AddToWalletIfInvolvingMe (#5452)

## Issue being fixed or feature implemented
It's super slow for wallets with 100.000s of keys and txes to reindex
and to rescan. Batching multiple operations fixes it. In my case (300K+
keys and 500k+ txes testnet wallet) `rescanblockchain` time is down from
6+ hours to ~10 minutes.

Re-calculating `block_time` over and over again inside of the loop in
`AddToWalletIfInvolvingMe` is wasteful, move it out.

## What was done?
batch what's possible, optimize `AddToWalletIfInvolvingMe`

## How Has This Been Tested?
running on top of #5451 , wiping and rescanning w/ and w/out this patch.

## Breaking Changes
should be none

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
UdjinM6 added a commit that referenced this pull request Jun 28, 2023
…pdates for huge notification queues (#5453)

## Issue being fixed or feature implemented
It's super slow for wallets with 100.000s of txes to process lots of
notifications produced by rescan. Skip them all and simply refresh the
whole wallet instead. In my case (500k+ txes testnet wallet) gui update
after `rescanblockchain` time is down from _forever_ to ~30 seconds.
Same for `wipewallettxes true` (#5451 ). Gui update after
`wipewallettxes`/`wipewallettxes false` is instant (cause there are no
txes anymore) vs _forever_ before the patch.


## What was done?
refresh the whole wallet when notification queue is above 10K operations

actual changes (ignoring whitespaces):
d013cb4?w=1

## How Has This Been Tested?
running on top of #5451 and #5452 , wiping and rescanning w/ and w/out
this patch.

## Breaking Changes
should be none


## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
UdjinM6 added a commit to UdjinM6/dash that referenced this pull request Jul 25, 2023
…-wallet` tool (dashpay#5451)

## Issue being fixed or feature implemented
Given the hard fork that happened on testnet, there is now lots of the
transactions that were made on the fork that is no longer valid. Some
transactions could be relayed and mined again but some like coinjoin
mixing won't be relayed because of 0 fee and transactions spending
coinbases from the forked branch are no longer valid at all.

## What was done?
Introduce `wipewallettxes` RPC and `wipetxes` command for `dash-wallet`
tool to be able to get rid of some/all txes in the wallet.

## How Has This Been Tested?
run tests, use rpc/command on testnet wallet

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
UdjinM6 added a commit to UdjinM6/dash that referenced this pull request Jul 25, 2023
…pdates for huge notification queues (dashpay#5453)

## Issue being fixed or feature implemented
It's super slow for wallets with 100.000s of txes to process lots of
notifications produced by rescan. Skip them all and simply refresh the
whole wallet instead. In my case (500k+ txes testnet wallet) gui update
after `rescanblockchain` time is down from _forever_ to ~30 seconds.
Same for `wipewallettxes true` (dashpay#5451 ). Gui update after
`wipewallettxes`/`wipewallettxes false` is instant (cause there are no
txes anymore) vs _forever_ before the patch.


## What was done?
refresh the whole wallet when notification queue is above 10K operations

actual changes (ignoring whitespaces):
dashpay@d013cb4?w=1

## How Has This Been Tested?
running on top of dashpay#5451 and dashpay#5452 , wiping and rescanning w/ and w/out
this patch.

## Breaking Changes
should be none


## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
@UdjinM6 UdjinM6 modified the milestones: 20, 19.3 Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RPC Some notable changes to RPC params/behaviour/descriptions tests An enhancement or modification to the function or unit test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants