SatSale/SatSale

"Fix rpc for default wallet" has introduced some bug for my setup

Closed this issue · 3 comments

When requesting payment.
image

$ gunicorn -w 1 -b 0.0.0.0:8000 satsale:app
[2021-12-16 14:39:07 +0200] [11881] [INFO] Starting gunicorn 20.0.4
[2021-12-16 14:39:07 +0200] [11881] [INFO] Listening at: http://0.0.0.0:8000 (11881)
[2021-12-16 14:39:07 +0200] [11881] [INFO] Using worker: sync
[2021-12-16 14:39:07 +0200] [11883] [INFO] Booting worker with pid: 11883
Initialised Flask with secret key: c1cb07f61bc76def00d1262ab1c2f7a3f61008981ff4f847b32f503a90c4fbe3851bab5f7b583d33fb67759aa86930e626c98d97db334ed16594f42da936dc25
Connecting to node...
Attempting to connect to Bitcoin node RPC with user Zhikivators.
{'chain': 'signet', 'blocks': 68889, 'headers': 68889, 'bestblockhash': '00000123d7f2ad33ada57cfbb51bf7a5afa27439671abb7982780003fe33898e', 'difficulty': Decimal('0.002917400895177098'), 'time': 1639655456, 'mediantime': 1639654039, 'verificationprogress': Decimal('0.9998262729123087'), 'initialblockdownload': False, 'chainwork': '000000000000000000000000000000000000000000000000000000c248242e58', 'size_on_disk': 212175791, 'pruned': False, 'softforks': {'bip34': {'type': 'buried', 'active': True, 'height': 1}, 'bip66': {'type': 'buried', 'active': True, 'height': 1}, 'bip65': {'type': 'buried', 'active': True, 'height': 1}, 'csv': {'type': 'buried', 'active': True, 'height': 1}, 'segwit': {'type': 'buried', 'active': True, 'height': 1}, 'taproot': {'type': 'bip9', 'bip9': {'status': 'active', 'start_time': -1, 'timeout': 9223372036854775807, 'since': 0, 'min_activation_height': 0}, 'height': 0, 'active': True}}, 'warnings': 'This is a pre-release test build - use at your own risk - do not use for mining or merchant applications'}
Successfully contacted bitcoind.
Connection to bitcoin node successful.
-18: Requested wallet does not exist or is not loaded
Attempting again... 1/3...
-18: Requested wallet does not exist or is not loaded
Attempting again... 2/3...
-18: Requested wallet does not exist or is not loaded
Attempting again... 3/3...
Reconnecting...
Attempting to connect to Bitcoin node RPC with user Zhikivators.
{'chain': 'signet', 'blocks': 68889, 'headers': 68889, 'bestblockhash': '00000123d7f2ad33ada57cfbb51bf7a5afa27439671abb7982780003fe33898e', 'difficulty': Decimal('0.002917400895177098'), 'time': 1639655456, 'mediantime': 1639654039, 'verificationprogress': Decimal('0.9998258523388619'), 'initialblockdownload': False, 'chainwork': '000000000000000000000000000000000000000000000000000000c248242e58', 'size_on_disk': 212175791, 'pruned': False, 'softforks': {'bip34': {'type': 'buried', 'active': True, 'height': 1}, 'bip66': {'type': 'buried', 'active': True, 'height': 1}, 'bip65': {'type': 'buried', 'active': True, 'height': 1}, 'csv': {'type': 'buried', 'active': True, 'height': 1}, 'segwit': {'type': 'buried', 'active': True, 'height': 1}, 'taproot': {'type': 'bip9', 'bip9': {'status': 'active', 'start_time': -1, 'timeout': 9223372036854775807, 'since': 0, 'min_activation_height': 0}, 'height': 0, 'active': True}}, 'warnings': 'This is a pre-release test build - use at your own risk - do not use for mining or merchant applications'}
Successfully contacted bitcoind.
[2021-12-16 14:39:14,649] ERROR in app: Exception on /api/createpayment [GET]
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/user/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/user/.local/lib/python3.8/site-packages/flask_restplus/api.py", line 325, in wrapper
    resp = resource(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/flask_restplus/resource.py", line 44, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/user/git/SatSale/satsale.py", line 147, in get
    invoice["address"], invoice["rhash"] = node.get_address(
TypeError: cannot unpack non-iterable NoneType object

I checked, it's introduced with commit 5818ccc, no his problem with d161c35.

My setup:

$ grep wallet config.toml 
# Wallet (empty "" if your node has a single wallet, OR wallet name/path as shown in `biitcoin-cli listwallets`)
wallet = "signet"
$ bitcoin-cli -signet listwallets
[
  "signet",
  "jm-signet-test",
  "wo-descriptor-test",
  "signet-full-descripors",
  "watcher"
]

Ahh damn I shouldve tested 5818ccc more.

Deleted from history and force pushed since I only just added it. Apologies. Should be working now. But I think blank wallet = "" is having issues.

But I think blank wallet = "" is having issues.

It's hard with this one. It might mean to have just single wallet loaded (so no /wallet/ thing for RPC URL) or it can mean - use default wallet with multiple wallets setup. Thing is, old Bitcoin Core versions created default wallet by default and sometimes it's called "wallet.dat", sometimes it's called "". Guess depending from the Core version used when it was created or something. Never figured that out. In JoinMarket we just decided to not support blank wallet name in multi-wallet setup and recommended setup is to always create new wallet specifically for JM. Thinking about future - this will not be issue for new setups, as now Core does not create any wallet by default. Only potential issue for old setups that want to integrate with SatSale.

Thanks that's great to know. I'll add some pointers to the docs.