SatSale

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 5c3b41c4cee935d98b9ed9587226745bd6fc93c7
parent b10ba265af1c028602c977fc6d65b5e76ea6f868
Author: Kristaps Kaupe <kristaps@blogiem.lv>
Date:   Mon, 27 Jun 2022 19:34:58 +0300

Add configurable underpay amount for invoices to be considered paid

Diffstat:
Mconfig.py | 4++++
Mconfig.toml | 5+++++
Msatsale.py | 2+-
3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/config.py b/config.py @@ -98,10 +98,14 @@ redirect = get_opt("redirect", "https://github.com/nickfarrow/satsale") base_currency = get_opt("base_currency", "USD") currency_provider = get_opt("currency_provider", "COINGECKO") bitcoin_rate_multiplier = get_opt("bitcoin_rate_multiplier", 1.00) +allowed_underpay_amount = get_opt("allowed_underpay_amount", 0.00000001) liquid_address = get_opt("liquid_address", None) paynym = get_opt("paynym", None) free_mode = get_opt("free_mode", False) loglevel = get_opt("loglevel", "DEBUG") +if allowed_underpay_amount < 0: + raise Exception("allowed_underpay_amount cannot be negative") + #print(config) #print(tunnel_host) diff --git a/config.toml b/config.toml @@ -98,6 +98,11 @@ currency_provider = "COINGECKO" # Supported: COINDESK | COINGECKO # Values above 1.00 gives discount, values below add extra comission. bitcoin_rate_multiplier = 1.00 +# BTC amount allowed to be underpaid to consider invoice paid. +# It's recommended to keep it at least 0.00000001 BTC currently, +# due to https://github.com/SatSale/SatSale/issues/77 bug. +allowed_underpay_amount = 0.00000001 + # Weak Hands Mode - Automatically swap LN-BTC -> L-USDT using sideshift.ai # https://blockstream.com/liquid/ # Change lnd_macaroon='admin.macaroon', as you will also need to be able to spend with your lnd certificates. diff --git a/satsale.py b/satsale.py @@ -300,7 +300,7 @@ def check_payment_status(uuid): dbg_free_mode_cond = config.free_mode and (time.time() - invoice["time"] > 5) # If payment is paid - if (conf_paid >= float(invoice["btc_value"])) or dbg_free_mode_cond: + if (conf_paid >= float(invoice["btc_value"]) - config.allowed_underpay_amount) or dbg_free_mode_cond: status.update( { "payment_complete": 1,