feat: add negative topups (#2835)
* feat: add negative topups * remove topup dialog --------- Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
+6
-11
@@ -1,6 +1,6 @@
|
||||
import asyncio
|
||||
import hashlib
|
||||
from datetime import datetime
|
||||
from hashlib import sha256
|
||||
from os import urandom
|
||||
from typing import AsyncGenerator, Dict, Optional, Set
|
||||
|
||||
@@ -16,6 +16,7 @@ from bolt11 import (
|
||||
from loguru import logger
|
||||
|
||||
from lnbits.settings import settings
|
||||
from lnbits.utils.crypto import fake_privkey
|
||||
|
||||
from .base import (
|
||||
InvoiceResponse,
|
||||
@@ -35,14 +36,8 @@ class FakeWallet(Wallet):
|
||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||
self.payment_secrets: Dict[str, str] = {}
|
||||
self.paid_invoices: Set[str] = set()
|
||||
self.secret: str = settings.fake_wallet_secret
|
||||
self.privkey: str = hashlib.pbkdf2_hmac(
|
||||
"sha256",
|
||||
self.secret.encode(),
|
||||
b"FakeWallet",
|
||||
2048,
|
||||
32,
|
||||
).hex()
|
||||
self.secret = settings.fake_wallet_secret
|
||||
self.privkey = fake_privkey(self.secret)
|
||||
|
||||
async def cleanup(self):
|
||||
pass
|
||||
@@ -71,7 +66,7 @@ class FakeWallet(Wallet):
|
||||
elif unhashed_description:
|
||||
tags.add(
|
||||
TagChar.description_hash,
|
||||
hashlib.sha256(unhashed_description).hexdigest(),
|
||||
sha256(unhashed_description).hexdigest(),
|
||||
)
|
||||
else:
|
||||
tags.add(TagChar.description, memo or "")
|
||||
@@ -85,7 +80,7 @@ class FakeWallet(Wallet):
|
||||
secret = urandom(32).hex()
|
||||
tags.add(TagChar.payment_secret, secret)
|
||||
|
||||
payment_hash = hashlib.sha256(secret.encode()).hexdigest()
|
||||
payment_hash = sha256(secret.encode()).hexdigest()
|
||||
|
||||
tags.add(TagChar.payment_hash, payment_hash)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user