alexbosworth / ln-service

Node.js interface to LND
MIT License
318 stars 61 forks source link

Unit mismatch in Fees #120

Closed apotdevin closed 4 years ago

apotdevin commented 4 years ago

I believe there is some unit mismatch in the fee rates from getFeeRates and the expected fee rate in updateRoutingFees.

Units in docs:

Example: Changing fees with updateRoutingFees({lnd, fee_rate: 5000}) and then calling getFeeRates({lnd}) gives fee_rate of 5000sats instead of 5sats

alexbosworth commented 4 years ago

I'll take a look

alexbosworth commented 4 years ago

I think it's just a matter of confusing commenting, the values returned are correct: what you set is what is returned

alexbosworth commented 4 years ago

The comment says "parts per million" essentially - as in 1 mtok per 1 million mtok and 1 token per 1 million token, meaning the same thing

apotdevin commented 4 years ago

I see, so if I understood correctly, they are both in millitokens right?

alexbosworth commented 4 years ago

I see, so if I understood correctly, they are both in millitokens right?

This is a ratio, not a millitoken or tokens - it's parts/million - it's like a percentage

apotdevin commented 4 years ago

Ok, I understand, so you are never setting msats or sats just the percentage. That explains my confusion, sorry, didn't understand the units in the docs

alexbosworth commented 4 years ago

Yeah when ln-service was started there was very limited access to millitoken precision in the API, but now that they are more consistently added throughout the API I will shift more towards referencing millitokens over tokens

alexbosworth commented 4 years ago

I've updated the descriptions to remove mention of tokens and replace it with millitokens, that is more accurately describing the fee rates.