citp / testchain-generator

Generate synthetic blockchains
GNU General Public License v3.0
8 stars 7 forks source link

Failed because no wallet is loaded #5

Open lgehr opened 3 years ago

lgehr commented 3 years ago

When starting generate_chain.py I get the following message:

2021-08-04 15:23:05,067 - testchain.runner - INFO - datadir: /tmp/tmp47y3ckul
2021-08-04 15:23:05,067 - testchain.runner - INFO - Config file created at /tmp/tmp47y3ckul/bitcoin.conf
2021-08-04 15:23:05,071 - testchain.runner - INFO - Waiting 10 seconds for node to start
Traceback (most recent call last):
  File "/home/lgehr/HU/FG17/testchain-generator/generate_chain.py", line 18, in <module>
    generator = Runner(args.output_dir, args.chain, args.exec)
  File "/home/lgehr/HU/FG17/testchain-generator/testchain/runner.py", line 37, in __init__
    self.proxy.call("importprivkey", COINBASE_KEY)
  File "/home/lgehr/.local/lib/python3.9/site-packages/bitcointx/rpc.py", line 358, in call
    return self._call(service_name, *args)
  File "/home/lgehr/.local/lib/python3.9/site-packages/bitcointx/rpc.py", line 237, in _call
    raise JSONRPCError(
bitcointx.rpc.JSONRPCError: {'code': -18, 'message': 'No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created)'}
2021-08-04 15:23:15,086 - testchain.runner - INFO - Waiting 5 seconds for node to quit
Error: A fatal internal error occurred, see debug.log for details
Error: A fatal internal error occurred, see debug.log for details
lgehr commented 3 years ago

Seem like the feature has been removed in bitcoin-core 0.21.0.

The release nodes states:

Automatic wallet creation removed

Bitcoin Core will no longer automatically create new wallets on startup. It will load existing wallets specified by -wallet options on the command line or in bitcoin.conf or settings.json files. And by default it will also load a top-level unnamed (“”) wallet. However, if specified wallets don’t exist, Bitcoin Core will now just log warnings instead of creating new wallets with new keys and addresses like previous releases did.

New wallets can be created through the GUI (which has a more prominent create wallet option), through the bitcoin-cli createwallet or bitcoin-wallet create commands, or the createwallet RPC. (#15454, #20186)

lgehr commented 3 years ago

I have now added a createwallet testwallet call into the constructor of the Runner class.

Now it creates an output with 0 BTC an fails with {'code': -26, 'message': 'dust'}

Full Log:

2021-08-04 16:25:11,702 - testchain.runner - INFO - datadir: /tmp/tmpthdzniu6
2021-08-04 16:25:11,702 - testchain.runner - INFO - Config file created at /tmp/tmpthdzniu6/bitcoin.conf
2021-08-04 16:25:11,706 - testchain.runner - INFO - Waiting 10 seconds for node to start
2021-08-04 16:25:22,885 - testchain.runner - INFO - Starting chain tip is 0f576826fe8bd32dc169c6cccab4e3ae98ed55f4b287e723eb8979f024de5880
2021-08-04 16:25:23,645 - testchain.runner - WARNING - Creating output with 0 BTC
Traceback (most recent call last):
  File "/home/lgehr/HU/FG17/testchain-generator/generate_chain.py", line 31, in <module>
    generator.run()
  File "/home/lgehr/HU/FG17/testchain-generator/testchain/runner.py", line 184, in run
    g.run()
  File "/home/lgehr/HU/FG17/testchain-generator/testchain/motifs/motifs.py", line 12, in run
    self.create_peeling_chain()
  File "/home/lgehr/HU/FG17/testchain-generator/testchain/motifs/motifs.py", line 99, in create_peeling_chain
    txid = self.create_transaction(sources, destinations)
  File "/home/lgehr/HU/FG17/testchain-generator/testchain/generator.py", line 121, in create_transaction
    return self._send_transaction(tx, recipients)
  File "/home/lgehr/HU/FG17/testchain-generator/testchain/generator.py", line 182, in _send_transaction
    txid = self.proxy.sendrawtransaction(tx)
  File "/home/lgehr/.local/lib/python3.9/site-packages/bitcointx/rpc.py", line 669, in sendrawtransaction
    r = self._call('sendrawtransaction', hextx)
  File "/home/lgehr/.local/lib/python3.9/site-packages/bitcointx/rpc.py", line 237, in _call
    raise JSONRPCError(
bitcointx.rpc.VerifyRejectedError: {'code': -26, 'message': 'dust'}
2021-08-04 16:25:23,649 - testchain.runner - INFO - Waiting 5 seconds for node to quit
Error: A fatal internal error occurred, see debug.log for details
Error: A fatal internal error occurred, see debug.log for details
/tmp/tmpthdzniu6/regtest/wallets/testwallet: No such file or directory
lgehr commented 3 years ago

The dunst issue is fixed in the pending PR #4

See https://github.com/erasmospunk/testchain-generator/commit/793340a0b39ddb310ed97c3900daa947ada135bb