/ test / functional / wallet_disable.py
wallet_disable.py
 1  #!/usr/bin/env python3
 2  # Copyright (c) 2015-present The Bitcoin Core developers
 3  # Distributed under the MIT software license, see the accompanying
 4  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
 5  """Test a node with the -disablewallet option.
 6  
 7  - Test that validateaddress RPC works when running with -disablewallet
 8  - Test that it is not possible to mine to an invalid address.
 9  """
10  
11  from test_framework.test_framework import BitcoinTestFramework
12  from test_framework.util import assert_raises_rpc_error, assert_equal
13  
14  class DisableWalletTest (BitcoinTestFramework):
15      def set_test_params(self):
16          self.setup_clean_chain = True
17          self.num_nodes = 1
18          self.extra_args = [["-disablewallet"]]
19          self.wallet_names = []
20  
21      def run_test (self):
22          # Make sure wallet is really disabled
23          assert_raises_rpc_error(-32601, 'Method not found', self.nodes[0].getwalletinfo)
24          x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
25          assert_equal(x['isvalid'], False)
26          x = self.nodes[0].validateaddress('mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
27          assert_equal(x['isvalid'], True)
28  
29  
30  if __name__ == '__main__':
31      DisableWalletTest(__file__).main()