nanocurrency / nano-node

Nano is digital currency. Its ticker is: XNO and its currency symbol is: Ӿ
https://nano.org
BSD 3-Clause "New" or "Revised" License
3.48k stars 783 forks source link

Forbid confirmation_height_clear to run along with another node instance #3832

Open thsfs opened 2 years ago

thsfs commented 2 years ago

There is a recommendation in the docs for not using this option when the node is already running. This may lead to misbehavior on the node. Got a suggestion from Colin that trying an IPC connection may work to see if there is another local instance.

If so, an error message should be triggered, asking for a "cold run".

JerzyStanislawski commented 2 years ago

I was thinking about this one but have doubts with using IPC connection. What if running node has RPC disabled in config? Or connection would be created to nano_rpc process rather than node? I thought we could leverage named_mutex. Daemon could create such mutex with some constant name, CLI command could try to open it and in case of success it would trigger error. Would that work?

dsiganos commented 2 years ago

named_mutex makes sense to me