lncm / invoicer

Invoice generating service that lives on top of lnd.
https://hub.docker.com/r/lncm/invoicer
MIT License
8 stars 3 forks source link

Make invoicer not generate an invoice if LND is not ready #37

Open nolim1t opened 5 years ago

nolim1t commented 5 years ago

Just to make things more robust If synced_to_chain is false (usually after a LND restart) it should return a response saying it can't generate an invoice rather than hanging

meeDamian commented 5 years ago

The issue is the call to getinfo can sometimes take a few seconds (for so for undetermined reasons), and if I were to call it prior to every invoice generation call, it can slow it down significantly :/

But I agree it needs to be addressed somehow.

nolim1t commented 5 years ago

Maybe outsource it to the healthcheck endpoint. There may be uses for that still, but have the front end do some checks

meeDamian commented 5 years ago

After putting some thought into it, I think it makes sense to have a goroutine calling lnd periodically, and:

If call worked, but now fails: suicide If call returns not synced to chain tip: block API with some "not ready" error If call worked, and synced to chain tip: remove the block.