feat: lnd_rest allow self payments (#2760)

* Update lndrest.py

- added the ability to receive self payments on the node

[issue] You have to enable circular payment on lnd.conf. Note that lnd.conf doesn't allow allow_self_payment parameter, that is why is necessary to define that on transaction.

* feat: add LND rest `"allow_self_payment"` option

---------

Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
jjmmbb
2024-11-26 13:32:44 +01:00
committed by GitHub
co-authored by Vlad Stan
parent af568d0f31
commit f97f27121a
4 changed files with 12 additions and 4 deletions
+8 -2
View File
@@ -2,7 +2,7 @@ import asyncio
import base64
import hashlib
import json
from typing import AsyncGenerator, Dict, Optional
from typing import Any, AsyncGenerator, Dict, Optional
import httpx
from loguru import logger
@@ -168,9 +168,15 @@ class LndRestWallet(Wallet):
lnrpc_fee_limit["fixed_msat"] = f"{fee_limit_msat}"
try:
json_: dict[str, Any] = {
"payment_request": bolt11,
"fee_limit": lnrpc_fee_limit,
}
if settings.lnd_rest_allow_self_payment:
json_["allow_self_payment"] = 1
r = await self.client.post(
url="/v1/channels/transactions",
json={"payment_request": bolt11, "fee_limit": lnrpc_fee_limit},
json=json_,
timeout=None,
)
r.raise_for_status()