node: host is not closed if it was passed via option
We are replacing libp2p.Host in case of passing it through the option so it is not closed properly by lifecycle when node stops.
There is a question here that needs to be answered. Who is responsible for the lifecycle of a dependency given as an option?
Managing it ourselves is less error-prone for our code while it might cause problems for the user. However, though, if probably documented, the user will be glad to do do less work, delegating lifecycling to us, while we have better control.
The soon-to-be-released FX feature to add lifycling through annotations will facilitate the fix here.
Ref: https://github.com/celestiaorg/celestia-node/issues/923
This can be closed
I am not sure we resolved it. The lyfecycling for provided hosts is not figured out