lightningdevkit / ldk-node

A ready-to-go node implementation built using LDK.
Other
147 stars 73 forks source link

Document that blocking functions block #371

Closed tvolk131 closed 19 hours ago

tvolk131 commented 1 day ago

We ran into this issue in the Fedimint LDK lightning gateway due to calling Node::stop() in an async context without wrapping it in something like spawn_blocking(). We should mention in the documentation of all blocking functions that they block.

For context: I believe this is the code that caused the issue linked above: https://github.com/lightningdevkit/ldk-node/blob/3f1c8420dbf3d0b3b3fab36ddcb3f7533eac11c6/src/lib.rs#L849-L855

tnull commented 19 hours ago

We should mention in the documentation of all blocking functions that they block.

I'm not sure what you referring to here? LDK node has a mostly-blocking interface, the only exception is next_event_async. So you should expect that the methods block. Note however that as mentioned over at https://github.com/lightningdevkit/ldk-node/issues/372, we will support reusing you outer runtime context to avoid runtime stacking.

Closing this as duplicate of https://github.com/lightningdevkit/ldk-node/issues/372