cashubtc / nutshell

Chaumian ecash wallet and mint for Bitcoin
https://docs.cashu.space
MIT License
372 stars 93 forks source link

Mint: Talk to LND via gRPC #595

Closed lollerfirst closed 2 months ago

lollerfirst commented 2 months ago

pretty self-explanatory...

lollerfirst commented 2 months ago

Main Difference

We're using a single http2 connection and multiplexing all async request on it (as per Microsoft's suggested best practices: https://learn.microsoft.com/en-us/aspnet/core/grpc/performance?view=aspnetcore-8.0)

lollerfirst commented 2 months ago

[!NOTE] If the number of concurrent requests exceeds the maximum number, the excess requests are queued. It would be best if a new connection (or a pooled connection) handled them. Unfortunately as it stands grpcio does not have pooling logic.

lollerfirst commented 2 months ago

Apparently I was wrong: https://grpc.github.io/grpc/python/grpc_asyncio.html#grpc.aio.AioRpcError

gRPC Async API objects may only be used on the thread on which they were created. AsyncIO doesn’t provide thread safety for most of its APIs.

Apparently async grpcio cannot be used the way I am doing. I'll rectify that.

lollerfirst commented 2 months ago

asserts on the fee reserve of the melt quotes still fail which leaves me baffled because get_payment_quote is identical to its lndrest.py counterpart.