6868)
6969from .address_synchronizer import TX_HEIGHT_LOCAL
7070from .mnemonic import Mnemonic
71- from .lnutil import (channel_id_from_funding_tx , LnFeatures , SENT , MIN_FINAL_CLTV_DELTA_FOR_INVOICE ,
71+ from .lnutil import (channel_id_from_funding_tx , LnFeatures , SENT , MIN_FINAL_CLTV_DELTA_ACCEPTED ,
7272 PaymentFeeBudget , NBLOCK_CLTV_DELTA_TOO_FAR_INTO_FUTURE )
7373from .plugin import run_hook , DeviceMgr , Plugins
7474from .version import ELECTRUM_VERSION
@@ -1382,7 +1382,7 @@ async def add_hold_invoice(
13821382 amount : Optional [Decimal ] = None ,
13831383 memo : str = "" ,
13841384 expiry : int = 3600 ,
1385- min_final_cltv_expiry_delta : int = MIN_FINAL_CLTV_DELTA_FOR_INVOICE * 2 ,
1385+ min_final_cltv_expiry_delta : int = MIN_FINAL_CLTV_DELTA_ACCEPTED * 2 ,
13861386 wallet : Abstract_Wallet = None
13871387 ) -> dict :
13881388 """
@@ -1399,24 +1399,24 @@ async def add_hold_invoice(
13991399 assert payment_hash not in wallet .lnworker .payment_info , "Payment hash already used!"
14001400 assert payment_hash not in wallet .lnworker .dont_settle_htlcs , "Payment hash already used!"
14011401 assert wallet .lnworker .get_preimage (bfh (payment_hash )) is None , "Already got a preimage for this payment hash!"
1402- assert MIN_FINAL_CLTV_DELTA_FOR_INVOICE < min_final_cltv_expiry_delta < 576 , "Use a sane min_final_cltv_expiry_delta value"
1402+ assert MIN_FINAL_CLTV_DELTA_ACCEPTED < min_final_cltv_expiry_delta < 576 , "Use a sane min_final_cltv_expiry_delta value"
14031403 amount = amount if amount and satoshis (amount ) > 0 else None # make amount either >0 or None
14041404 inbound_capacity = wallet .lnworker .num_sats_can_receive ()
14051405 assert inbound_capacity > satoshis (amount or 0 ), \
14061406 f"Not enough inbound capacity [{ inbound_capacity } sat] to receive this payment"
14071407
1408+ wallet .lnworker .add_payment_info_for_hold_invoice (
1409+ bfh (payment_hash ),
1410+ lightning_amount_sat = satoshis (amount ) if amount else None ,
1411+ min_final_cltv_delta = min_final_cltv_expiry_delta ,
1412+ exp_delay = expiry ,
1413+ )
1414+ info = wallet .lnworker .get_payment_info (bfh (payment_hash ))
14081415 lnaddr , invoice = wallet .lnworker .get_bolt11_invoice (
1409- payment_hash = bfh (payment_hash ),
1410- amount_msat = satoshis (amount ) * 1000 if amount else None ,
1416+ payment_info = info ,
14111417 message = memo ,
1412- expiry = expiry ,
1413- min_final_cltv_expiry_delta = min_final_cltv_expiry_delta ,
14141418 fallback_address = None
14151419 )
1416- wallet .lnworker .add_payment_info_for_hold_invoice (
1417- bfh (payment_hash ),
1418- satoshis (amount ) if amount else None ,
1419- )
14201420 wallet .lnworker .dont_settle_htlcs [payment_hash ] = None
14211421 wallet .set_label (payment_hash , memo )
14221422 result = {
0 commit comments