Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Cannot connect to node any more #2070

Closed
relativisticelectron opened this issue Jan 19, 2023 · 11 comments · Fixed by #2084
Closed

Bug: Cannot connect to node any more #2070

relativisticelectron opened this issue Jan 19, 2023 · 11 comments · Fixed by #2084

Comments

@relativisticelectron
Copy link
Collaborator

relativisticelectron commented Jan 19, 2023

Describe the bug
Specter works fine on cee2355.
Specter cannot connect to the node any more in 31954a5

image

To Reproduce
Steps to reproduce the behavior:

  1. I have a version controlled .specter-dev config folder. This configuration works fine with cee2355 but no node can be found with 31954a5

Desktop (please complete the following information):

  • Where is your node running: local(external)]
  • specter master branch
  • If you're running a binary, which OS: Linux
@moneymanolis
Copy link
Collaborator

moneymanolis commented Jan 19, 2023

Can you check whether you have same problem on the UI revamp branch?
#1991

@relativisticelectron
Copy link
Collaborator Author

Can you check whether you have same problem on the UI revamp branch? #1991

Same problem on design-revamp

@k9ert
Copy link
Collaborator

k9ert commented Jan 20, 2023

I cannot reproduce this. So there is nothing in the logs? Can you maybe share your current node.json? There is a python_class key in there, right?
There are quite some commits since cee2355. So if you can't see anything in the logs, i'd bisect the commits since then. Start with the one in the middle and then divide and conquer:

fa9605d6c955f46bce441c759f6bf799a8c74ab3
e92811398fe1bca39f6f391d241c23c332d95e73
e499976e50a22fdbaf46fef7f5591dd778f56632
d8af9d109e0a5ae5a159467a14a483175d8f554c
f68eba63fe5a397f5bde5266aa989c7dc79bfa5d
ed0a2a8cf8a120ac75f1cbeb6b0a590ab42e7117
17b280b7014cdfc53f7a7e0a3d81c16d04e8e0d9
e64f6a0c159d84a96303efac4070be56ced86a6c
31954a51a022f48a44873b87ac337347083269e6
db8e4138913b4a7e328263d39214a8ac4ee766f6
e019658b8c7a147554883bb3629e70a3d28c88c1
689a937f213804dd3f79448ec15a77ce7d11d196
0fecdb60eeae10077cbd869552510465997b0dc7
0e6b99bf9954464f9ca67d8310d5078a5280f27b
6c320f883608866efbe835fa373d0f5aeee07ba1
2a03ec1718a46672522359478f36ff93a09439c7
cb85062187741e0fd8cc2e807f40b7d3589e0e86
c2db8b4f63b950a5e151cf4bba2765cfadb4c028
99aef91c902efb6d80b46514f91b0dee048970a8
984867a18097c047f82c2ea4e162aed72839b9a4
c1c925f037bebe22db9f85b4c7593c7d5e4de077
eb27384666be14c33b7b93cf9f42df2a41a568c1
fa29a08db1bab303f46f19473e6ef0591db9e0a9
cee235592925505c831b55660d2a59c8fc190271

@relativisticelectron
Copy link
Collaborator Author

relativisticelectron commented Jan 21, 2023

2a03ec1 caused the loss of node connection. Regtest node is running and can be found fine in cb85062. Log output of python3 -m cryptoadvance.specter server --config DevelopmentConfig --port 1234 --ssl --host 0.0.0.0 --debug :


[2023-01-21 16:18:38,668] INFO in service_manager: ----> finished service loading
[2023-01-21 16:18:38,668] INFO in specter: Instantiate VersionChecker
[2023-01-21 16:18:38,669] INFO in specter: Instantiate ConfigManager
[2023-01-21 16:18:38,669] DEBUG in genericdata_manager: Loading existing file /home/<user>/.specter_dev/config.json
[2023-01-21 16:18:38,670] INFO in specter: Instantiate NodeManager with node alias: default.
[2023-01-21 16:18:38,679] WARNING in node: connection of <Node name=Bitcoin Core fullpath=/home/<user>/.specter_dev/nodes/default.json> is None in check_info
[2023-01-21 16:18:38,679] DEBUG in node: Node is not running, no RPC connection, check_info didn't succeed, setting RPC attribute to None ...
[2023-01-21 16:18:38,679] DEBUG in node: Updating <Node name=Bitcoin Core fullpath=/home/<user>/.specter_dev/nodes/default.json>.rpc None with None (setter)
[2023-01-21 16:18:38,679] INFO in node_manager: Loaded Node <Node name=Bitcoin Core fullpath=/home/<user>/.specter_dev/nodes/default.json>
[2023-01-21 16:18:38,681] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:18891>
[2023-01-21 16:18:38,683] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:18891>
[2023-01-21 16:18:38,684] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:18891>
[2023-01-21 16:18:38,686] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:18891>
[2023-01-21 16:18:38,686] WARNING in node: connection of <Node name=elements fullpath=/home/<user>/.specter_dev/nodes/elements.json> is None in check_info
[2023-01-21 16:18:38,686] DEBUG in node: Node is not running, no RPC connection, check_info didn't succeed, setting RPC attribute to None ...
[2023-01-21 16:18:38,686] DEBUG in node: Updating <Node name=elements fullpath=/home/<user>/.specter_dev/nodes/elements.json>.rpc None with None (setter)
[2023-01-21 16:18:38,686] INFO in node_manager: Loaded Node <Node name=elements fullpath=/home/<user>/.specter_dev/nodes/elements.json>
[2023-01-21 16:18:38,688] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:8081>
[2023-01-21 16:18:38,689] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:8081>
[2023-01-21 16:18:38,691] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:8081>
[2023-01-21 16:18:38,692] ERROR in node:  while get_rpc for <BitcoinRpc http://localhost:8081>
[2023-01-21 16:18:38,692] WARNING in node: connection of <Node name=spectrum electrs fullpath=/home/<user>/.specter_dev/nodes/spectrum_electrs.json> is None in check_info
[2023-01-21 16:18:38,692] DEBUG in node: Node is not running, no RPC connection, check_info didn't succeed, setting RPC attribute to None ...
[2023-01-21 16:18:38,692] DEBUG in node: Updating <Node name=spectrum electrs fullpath=/home/<user>/.specter_dev/nodes/spectrum_electrs.json>.rpc None with None (setter)
[2023-01-21 16:18:38,692] INFO in node_manager: Loaded Node <Node name=spectrum electrs fullpath=/home/<user>/.specter_dev/nodes/spectrum_electrs.json>
[2023-01-21 16:18:38,692] DEBUG in specter: This is the active node in the node manager: <Node name=Bitcoin Core fullpath=/home/<user>/.specter_dev/nodes/default.json>
[2023-01-21 16:18:38,693] DEBUG in node: Updating <Node name=Bitcoin Core fullpath=/home/<user>/.specter_dev/nodes/default.json>.rpc None with None (setter)
[2023-01-21 16:18:38,694] WARNING in node: connection of <Node name=Bitcoin Core fullpath=/home/<user>/.specter_dev/nodes/default.json> is None in check_info
[2023-01-21 16:18:38,694] DEBUG in node: Node is not running, no RPC connection, check_info didn't succeed, setting RPC attribute to None ...
[2023-01-21 16:18:38,694] DEBUG in node: Updating <Node name=Bitcoin Core fullpath=/home/<user>/.specter_dev/nodes/default.json>.rpc None with None (setter)
[2023-01-21 16:18:38,695] DEBUG in wallet_manager: starting update of wallet_manager
[2023-01-21 16:18:38,695] INFO in wallet_manager: Skipping further update because self.working_folder is None (and data_folder = /home/<user>/.specter_dev/wallets)
[2023-01-21 16:18:38,695] WARNING in wallet_manager: Specter seems to be disconnected from Bitcoin Core. Skipping wallets update.
[2023-01-21 16:18:38,695] DEBUG in wallet_manager: starting update of wallet_manager
[2023-01-21 16:18:38,695] INFO in wallet_manager: Skipping further update because self.working_folder is None (and data_folder = /home/<user>/.specter_dev/wallets_user1)
[2023-01-21 16:18:38,695] WARNING in wallet_manager: Specter seems to be disconnected from Bitcoin Core. Skipping wallets update.
[2023-01-21 16:18:38,696] WARNING in specter: Failed to connect to Tor control port. Error: [Errno 111] Connection refused
[2023-01-21 16:18:38,696] INFO in checker: Checker health Checking every 600 seconds now

After migration 2 default.json is:

{
    "name": "Bitcoin Core",
    "alias": "default",
    "autodetect": true,
    "datadir": "/home/<user>/.bitcoin/",
    "user": "bitcoin",
    "password": "<password>",
    "port": "18443",
    "host": "localhost",
    "protocol": "http",
    "external_node": true,
    "fullpath": "/home/<user>/.specter_dev/nodes/default.json",
    "node_type": "BTC",
    "python_class": "cryptoadvance.specter.node.Node"
}

PS: It would help if migrations would not be identified by a number (e.g. 002), but by a id-string + a reference to the previous id-string, forming a unique migration-order. That way switching branches could raise an exception if one tries to do migrations in the wrong order. (Currently if one works on 2 branches both containing conflicting migrations, there is no automatic detection possible, if one switches and the migration of the other branch was applied already).

@k9ert
Copy link
Collaborator

k9ert commented Jan 23, 2023

So you're using auto-detection? Can you maybe provide your bitcoin.conf in an anonymized form? I'd then probably create a test out of it.
Regarding the migrations: The number ensures that the migrations are executed in a specific order. I can't see how your proposal would ensure that because both new migrations would then have the same number and referring to the same old migration.
I think for migrations, there is almost no way around that all developers need to be aware about migrations all the time as the migration is only final after releasing. Before that, every migration could potentially change and people need to delete the reference in their specter-folder in order to let the migration run again.

@relativisticelectron
Copy link
Collaborator Author

Yes I am using autodetection. My bitcoin.conf is almost default:

maxmempool=700
server=1
prune=700
[main]
[test]
[regtest]
prune=0
zmqpubrawblock=tcp://127.0.0.1:29000
zmqpubrawtx=tcp://127.0.0.1:29000
zmqpubhashtx=tcp://127.0.0.1:29000
zmqpubhashblock=tcp://127.0.0.1:29000

@k9ert
Copy link
Collaborator

k9ert commented Jan 26, 2023

I'm not sure how it's suppose to work in that case. If i use a bitcoin-cli with that bitcoin.conf, it tries to connect to mainnet. What about adding a regtest=1 in the upper section?
Also i'm not sure how the credentials should be treated if they are empty?

I'm aware that it worked before and now no longer but it also was probably underspecified before. So getting that straight now is the best we can do.
@Kexkey any points from your side?

@Kexkey
Copy link
Contributor

Kexkey commented Jan 26, 2023

I think Specter should use bitcoin.conf the same way Bitcoin Core does. For example, I'm pretty sure Core uses mainnet as the default network if not specified. I also think it uses 127.0.0.1 as the default host and default ports 8332, 8333, 18332, 18333, etc..

If I'm not mistaken, before my PR, Specter was taking default.json as the default values, so if there was port 18443 there, if not specified in bitcoin.conf, it would take that value even if being on mainnet, instead of taking Bitcoin default values for mainnet.

The point is in some context, the bitcoin.conf file used by Specter is exactly the same file used by the Bitcoin Core instance, so it has to read it the same way.

Writing off the top of my head, we would need to double-check to be sure...

@Kexkey
Copy link
Contributor

Kexkey commented Jan 26, 2023

Just to clarify, I meant when Specter is in auto-detect mode...

P.S.: one of the ways to work around some mix-and-match config problems between bitcoin.conf and default.json before the PR was to set the right values in default.json and then turn on auto-detect... :)

@moneymanolis
Copy link
Collaborator

@Kexkey we are removing the default node, see #2072
And we put some thought into default connection values and automatic reading of a bitcoin.conf if it is available in the UIUX revamp #1991. We will be merging the latter soon to master (probably). Would be great if you could give feedback on the new connection UX and perhaps you find bugs, that the tests didn't pick up.

@k9ert
Copy link
Collaborator

k9ert commented Jan 27, 2023

@relativisticelectron I've created a PR (#2048 )with a test which test your bitcoin.conf. I then checked out an older tag and let the test run there and the result was also an empty list op potential connections:
https://github.com/cryptoadvance/specter-desktop/pull/2084/files#diff-9f384acff39a961fbf36e111457c5d0d59e7a22c45b80b160de2328deea4b038R127

So i don't understand what changed for you but i also think that your bitcoin.conf should get some optimisations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants