bitcoinops / taproot-workshop

Taproot & Schnorr Python Library & Documentation.
MIT License
369 stars 111 forks source link

"This type of wallet does not support this command" error on later versions of bitcoin core #176

Closed thunderbiscuit closed 2 years ago

thunderbiscuit commented 2 years ago

Hi there. Thank you for the hard work on this! A few friends and I will be working through the content over the next few weeks.

I have cloned and installed bitcoin core, and specified the correct path for SOURCE_DIRECTORY.

When running the cell with

test = TestWrapper()
# Start TestNodes

test.setup()

I get the following error:

2021-12-10T17:45:16.333000Z TestFramework./tmp/bitcoin_func_test_vhof0ruu (INFO): Initializing test directory /tmp/bitcoin_func_test_vhof0ruu

---------------------------------------------------------------------------
JSONRPCException                          Traceback (most recent call last)
/tmp/ipykernel_38680/2319113749.py in <module>
      2 # Start TestNodes
      3 
----> 4 test.setup()

~/repos/taproot-workshop/util.py in setup(self, bitcoind, bitcoincli, setup_clean_chain, num_nodes, network_thread, rpc_timeout, supports_cli, bind_to_localhost_only, nocleanup, noshutdown, cachedir, tmpdir, loglevel, trace_rpc, port_seed, coveragedir, configfile, pdbonfailure, usecli, perf, randomseed)
    101             self.options.bitcoincli = bitcoincli
    102 
--> 103             super().setup()
    104 
    105             # Add notebook-specific methods

~/repos/taproot-workshop/test_framework/test_framework.py in setup(self)
    207         self.skip_test_if_missing_module()
    208         self.setup_chain()
--> 209         self.setup_network()
    210 
    211     def shutdown(self, e=None, exit=False):

~/repos/taproot-workshop/test_framework/test_framework.py in setup_network(self)
    305     def setup_network(self):
    306         """Override this method to customize test network topology"""
--> 307         self.setup_nodes()
    308 
    309         # Connect the nodes as a "chain".  This allows us

~/repos/taproot-workshop/test_framework/test_framework.py in setup_nodes(self)
    322         self.start_nodes()
    323         if self.is_wallet_compiled():
--> 324             self.import_deterministic_coinbase_privkeys()
    325         if not self.setup_clean_chain:
    326             for n in self.nodes:

~/repos/taproot-workshop/test_framework/test_framework.py in import_deterministic_coinbase_privkeys(self)
    339     def import_deterministic_coinbase_privkeys(self):
    340         for i in range(self.num_nodes):
--> 341             self.init_wallet(i)
    342 
    343     def init_wallet(self, i):

~/repos/taproot-workshop/test_framework/test_framework.py in init_wallet(self, i)
    347             if wallet_name is not None:
    348                 n.createwallet(wallet_name=wallet_name, load_on_startup=True)
--> 349             n.importprivkey(privkey=n.get_deterministic_priv_key().key, label='coinbase')
    350 
    351     def run_test(self):

~/repos/taproot-workshop/test_framework/coverage.py in __call__(self, *args, **kwargs)
     45 
     46         """
---> 47         return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
     48         self._log_call()
     49         return return_val

~/repos/taproot-workshop/test_framework/authproxy.py in __call__(self, *args, **argsn)
    139         response, status = self._request('POST', self.__url.path, postdata.encode('utf-8'))
    140         if response['error'] is not None:
--> 141             raise JSONRPCException(response['error'], status)
    142         elif 'result' not in response:
    143             raise JSONRPCException({

JSONRPCException: This type of wallet does not support this command (-4)

Any ideas what I might be doing wrong? It makes me think maybe the disablewallet option is set to 1, but I haven't set that up anywhere. I'm not sure where to fiddle with the config file either, because I don't have a ~/.bitcoin/ directory created at this point (after simply installing/making from source and not running anything).

Any help appreciated!

Additional info

I built bitcoin core using the recommended

./autogen.sh
./configure
make
make install

The next cells don't actually throw errors per se:

version = test.nodes[0].getnetworkinfo()['subversion']
print("Client version is {}".format(version))
assert "Satoshi" in version

blockchain_info = test.nodes[0].getblockchaininfo()
assert 'taproot' in blockchain_info['softforks']
assert blockchain_info['softforks']['taproot']['active']

# Client version is /Satoshi:22.99.0(testnode0)/

but then:

# Shutdown TestNodes
test.shutdown()

# TestWrapper is not running!

Is it possible by any chance to go through the workshop using a straight install of the binaries without cloning the bitcoin core repo, aka something like

wget https://bitcoincore.org/bin/bitcoin-core-22.0/bitcoin-22.0-x86_64-linux-gnu.tar.gz
# verify signatures, etc
...

?

rajarshimaitra commented 2 years ago

This is happening because latest bitcoin core node creates DescriptorWallet by default if sqlite lib is installed. Which is probably the case in your local.

Most of the rpc commands emitted by test framework in this repo works with LegacyWallet. So modifying the test framework code here https://github.com/bitcoinops/taproot-workshop/blob/ec565981b83b24744b94498641a9eac22f59e0f0/test_framework/test_framework.py#L348 like this n.createwallet(wallet_name=wallet_name, load_on_startup=True, descriptors=False) solved it for me.

thunderbiscuit commented 2 years ago

Yep that did it. Thanks @rajarshimaitra!

thunderbiscuit commented 2 years ago

Fixed the title so it's easier to find for other people who come across the same error.