mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
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:
@@ -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__':
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user