forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: introduce wipewallettxes RPC and wipetxes command for dash-wallet tool
#5451
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
25b3e32
feat(rpc): add `wipewallettxes`
UdjinM6 4c1c07c
test: add test for `wipewallettxes` rpc
UdjinM6 d2f1a94
feat: add `wipetxes` command to dash-wallet
UdjinM6 d793d58
test: add test for `wipetxes` command
UdjinM6 cdb153a
feat(wallet): let WalletRescanReserver reset fAbortRescan
UdjinM6 feac820
feat(rpc): make `wipewallettxes` interactive in qt
UdjinM6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) 2023 The Dash Core developers | ||
| # Distributed under the MIT software license, see the accompanying | ||
| # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
| """Test transaction wiping using the wipewallettxes RPC.""" | ||
|
|
||
| from test_framework.test_framework import BitcoinTestFramework | ||
| from test_framework.util import assert_equal, assert_raises_rpc_error | ||
|
|
||
|
|
||
| class WipeWalletTxesTest(BitcoinTestFramework): | ||
| def set_test_params(self): | ||
| self.setup_clean_chain = True | ||
| self.num_nodes = 1 | ||
|
|
||
| def skip_test_if_missing_module(self): | ||
| self.skip_if_no_wallet() | ||
|
|
||
| def run_test(self): | ||
| self.log.info("Test that wipewallettxes removes txes and rescanblockchain is able to recover them") | ||
| self.nodes[0].generate(101) | ||
| txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1) | ||
| self.nodes[0].generate(1) | ||
| assert_equal(self.nodes[0].getwalletinfo()["txcount"], 103) | ||
| self.nodes[0].wipewallettxes() | ||
| assert_equal(self.nodes[0].getwalletinfo()["txcount"], 0) | ||
| self.nodes[0].rescanblockchain() | ||
| assert_equal(self.nodes[0].getwalletinfo()["txcount"], 103) | ||
|
|
||
| self.log.info("Test that wipewallettxes removes txes but keeps confirmed ones when asked to") | ||
| txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1) | ||
| assert_equal(self.nodes[0].getwalletinfo()["txcount"], 104) | ||
| self.nodes[0].wipewallettxes(True) | ||
| assert_equal(self.nodes[0].getwalletinfo()["txcount"], 103) | ||
| self.nodes[0].rescanblockchain() | ||
| assert_equal(self.nodes[0].getwalletinfo()["txcount"], 103) | ||
| assert_raises_rpc_error(-5, "Invalid or non-wallet transaction id", self.nodes[0].gettransaction, txid) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| WipeWalletTxesTest().main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
// Hidden1253e6d#diff-0d04b20c6ef91f3f8e0ab7cf0e17dde5665b82e9c838f8ad94fc5bd488757d76R32.