wallet: rpc: deprecate removeprunedfunds

This RPC has no helpful use while being both dangerous and a maintenance
burden.

Despite what the name says, it allows the deletion of arbitrary
transactions, and `importprunedfunds` does not allow the importing of
transactions not belonging to the user, and `listtransactions` does not
list transactions not belonging to the wallet, so this RPC can only be
used to delete transactions actually belonging to the wallet, and in the
unlikely event that transactions not belonging to the wallet are
present, they cause no harm except for occupying a few bytes on the
users disk.
This commit is contained in:
David Gumberg
2026-06-25 22:23:59 +00:00
parent e5b7785447
commit f280f5eb47
4 changed files with 25 additions and 1 deletions

View File

@@ -4,6 +4,8 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_raises_rpc_error
class DeprecatedRpcTest(BitcoinTestFramework):
def set_test_params(self):
@@ -26,7 +28,17 @@ class DeprecatedRpcTest(BitcoinTestFramework):
# Please don't delete nor modify this comment
self.log.info("Tests for deprecated RPC methods (if any)")
self.log.info("Currently no tests for deprecated RPC methods")
if self.is_wallet_compiled():
self.log.info("Tests for deprecated wallet-related RPC methods (if any)")
self.nodes[0].createwallet("ancient_wallet")
wallet = self.nodes[0].get_wallet_rpc("ancient_wallet")
self.log.info("Test removeprunedfunds deprecation")
assert_raises_rpc_error(
-32, "Start bitcoind with the `-deprecatedrpc=removeprunedfunds`",
wallet.removeprunedfunds,
"fakeargument"
)
if __name__ == '__main__':

View File

@@ -25,6 +25,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
self.extra_args = [["-deprecatedrpc=removeprunedfunds"]] * 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()