Browse Source

fee reserve defaults to 0.

fee_issues
fiatjaf 5 years ago
parent
commit
5f6585eb45
  1. 2
      .env.example
  2. 8
      lnbits/__init__.py
  3. 2
      lnbits/settings.py

2
.env.example

@ -4,3 +4,5 @@ FLASK_ENV=development
LNTXBOT_API_ENDPOINT=https://lntxbot.bigsun.xyz/
LNTXBOT_ADMIN_KEY=LNTXBOT_ADMIN_KEY
LNTXBOT_INVOICE_KEY=LNTXBOT_INVOICE_KEY
FEE_RESERVE=0.01

8
lnbits/__init__.py

@ -9,7 +9,7 @@ from lnurl import Lnurl, LnurlWithdrawResponse
from . import bolt11
from .db import Database
from .helpers import megajson
from .settings import LNBITS_PATH, WALLET, DEFAULT_USER_WALLET_NAME
from .settings import LNBITS_PATH, WALLET, DEFAULT_USER_WALLET_NAME, FEE_RESERVE
app = Flask(__name__)
@ -187,12 +187,12 @@ def wallet():
coalesce(
(SELECT balance/1000 FROM balances WHERE wallet = wallets.id),
0
) AS balance,
) * ? AS balance,
*
FROM wallets
WHERE user = ? AND id = ?
""",
(usr, wallet_id),
(FEE_RESERVE, usr, wallet_id),
)
transactions = db.fetchall("SELECT * FROM apipayments WHERE wallet = ? AND pending = 0", (wallet_id,))
@ -275,7 +275,7 @@ def api_transactions():
(
invoice.payment_hash,
-int(invoice.amount_msat),
-int(invoice.amount_msat * 0.01),
-int(invoice.amount_msat) * FEE_RESERVE,
wallet["id"],
invoice.description,
),

2
lnbits/settings.py

@ -15,3 +15,5 @@ WALLET = LntxbotWallet(
LNBITS_PATH = os.path.dirname(os.path.realpath(__file__))
DATABASE_PATH = os.getenv("DATABASE_PATH") or os.path.join(LNBITS_PATH, "data", "database.sqlite3")
DEFAULT_USER_WALLET_NAME = os.getenv("DEFAULT_USER_WALLET_NAME") or "Bitcoin LN Wallet"
FEE_RESERVE = float(os.getenv("FEE_RESERVE") or 0)

Loading…
Cancel
Save