You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

disablewallet.py 1.5KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. # Copyright (c) 2015-2016 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. - Test that validateaddress RPC works when running with -disablewallet
  7. - Test that it is not possible to mine to an invalid address.
  8. """
  9. from test_framework.test_framework import BitcoinTestFramework
  10. from test_framework.util import *
  11. class DisableWalletTest (BitcoinTestFramework):
  12. def set_test_params(self):
  13. self.setup_clean_chain = True
  14. self.num_nodes = 1
  15. self.extra_args = [["-disablewallet"]]
  16. def run_test (self):
  17. # Make sure wallet is really disabled
  18. assert_raises_rpc_error(-32601, 'Method not found', self.nodes[0].getwalletinfo)
  19. x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
  20. assert(x['isvalid'] == False)
  21. x = self.nodes[0].validateaddress('mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
  22. assert(x['isvalid'] == True)
  23. # Checking mining to an address without a wallet. Generating to a valid address should succeed
  24. # but generating to an invalid address will fail.
  25. self.nodes[0].generatetoaddress(1, 'mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
  26. assert_raises_rpc_error(-5, "Invalid address", self.nodes[0].generatetoaddress, 1, '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
  27. if __name__ == '__main__':
  28. DisableWalletTest ().main ()