BlueWallet / LndHub

Wrapper for Lightning Network Daemon. It provides separate accounts for end-users
http://LndHub.io
MIT License
752 stars 185 forks source link

remove %1 fee by internal invoice #294

Open TheCherry opened 2 years ago

TheCherry commented 2 years ago

What will happen if we move the if statement:

https://github.com/BlueWallet/LndHub/blob/master/controllers/api.js#L238

to the regular lightning network logic:

https://github.com/BlueWallet/LndHub/blob/master/controllers/api.js#L290

In the end we don't need to check internal for the fee, am I right?

xraid commented 2 years ago

You can now set fees in the config.js file on version 1.4.0

forwardReserveFee: 0.01, // default 0.01 intraHubFee: 0.003, // default 0.003

Blazerinho commented 2 years ago

where can I find config.js on umbrel directory?

Blazerinho commented 2 years ago

and can I see who gets intrahubfee?

xraid commented 2 years ago

in folder lndhub/config.js You can adjust fees

intrahubfee is for all accounts connected to the LndHub instance

xraid commented 2 years ago

docker exec -it "mycontainer" bash

and nano config.js

hazrulnizam commented 2 years ago

You can now set fees in the config.js file on version 1.4.0

forwardReserveFee: 0.01, // default 0.01 intraHubFee: 0.003, // default 0.003

As the code stands right now, we cannot set the internal hub fee to zero. Setting intraHubFee: 0.000 in config.js does not change the fee to zero because the code does not catch it due to simple using the OR operator in order to set default values.

https://github.com/BlueWallet/LndHub/blob/05eace759fdb7b2b3e84b2b8b1e92161b68e0d2b/controllers/api.js#L19-L25

Perhaps a more robust check on whether the variable is defined is needed.

xraid commented 2 years ago

yeah a change was made in good faith here : https://github.com/BlueWallet/LndHub/commit/e42ef3a85e3792d61a5c0e4ae124ec4c48797e64

Blazerinho commented 2 years ago

Finally I found a workaround to set fees to zero. dirty but it works as long you don't restart umbrel. 'login to umbrel using cmd 'Enter following command to get into umbrel SSH -t umbrel@umbrel.local 'Enter "your umbrel password" 'find out and note container ID of bluewalletorganization/lndhub:v1.4.1 with Docker ps 'get into Container docker exec -u 0 -it "Bluewallet Container ID" /bin/sh 'update library apt-get update 'install nano apt-get install nano 'edit file api.js nano /lndhub/controllers/api.js 'modify line of fees global.forwardFee = 0.00; global.internalFee = 0.000; 'CTRL + X to save 'restart docker docker restart "Bluewallet Container ID" exit

Blazerinho commented 2 years ago

@hazrulnizam you are right. Due to || being a boolean logical operator, the left hand-side operand was coerced to a boolean for the evaluation and any falsy value (0, '', NaN, null, undefined) was not returned. This behavior may cause unexpected consequences if you consider 0, '', or NaN as valid values. I guess that 0.00 is also a falsy value. Can anybody debug that behavior? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator