mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 14:51:05 +01:00
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:
parent
af568d0f31
commit
f97f27121a
4 changed files with 12 additions and 4 deletions
|
@ -323,6 +323,7 @@ class LndRestFundingSource(LNbitsSettings):
|
||||||
lnd_rest_macaroon: Optional[str] = Field(default=None)
|
lnd_rest_macaroon: Optional[str] = Field(default=None)
|
||||||
lnd_rest_macaroon_encrypted: Optional[str] = Field(default=None)
|
lnd_rest_macaroon_encrypted: Optional[str] = Field(default=None)
|
||||||
lnd_rest_route_hints: bool = Field(default=True)
|
lnd_rest_route_hints: bool = Field(default=True)
|
||||||
|
lnd_rest_allow_self_payment: bool = Field(default=False)
|
||||||
lnd_cert: Optional[str] = Field(default=None)
|
lnd_cert: Optional[str] = Field(default=None)
|
||||||
lnd_admin_macaroon: Optional[str] = Field(default=None)
|
lnd_admin_macaroon: Optional[str] = Field(default=None)
|
||||||
lnd_invoice_macaroon: Optional[str] = Field(default=None)
|
lnd_invoice_macaroon: Optional[str] = Field(default=None)
|
||||||
|
|
2
lnbits/static/bundle-components.min.js
vendored
2
lnbits/static/bundle-components.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -64,7 +64,8 @@ window.app.component('lnbits-funding-sources', {
|
||||||
lnd_rest_cert: 'Certificate',
|
lnd_rest_cert: 'Certificate',
|
||||||
lnd_rest_macaroon: 'Macaroon',
|
lnd_rest_macaroon: 'Macaroon',
|
||||||
lnd_rest_macaroon_encrypted: 'Encrypted Macaroon',
|
lnd_rest_macaroon_encrypted: 'Encrypted Macaroon',
|
||||||
lnd_rest_route_hints: 'Enable Route Hints'
|
lnd_rest_route_hints: 'Enable Route Hints',
|
||||||
|
lnd_rest_allow_self_payment: 'Allow Self Payment'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
|
@ -2,7 +2,7 @@ import asyncio
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
from typing import AsyncGenerator, Dict, Optional
|
from typing import Any, AsyncGenerator, Dict, Optional
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
@ -168,9 +168,15 @@ class LndRestWallet(Wallet):
|
||||||
lnrpc_fee_limit["fixed_msat"] = f"{fee_limit_msat}"
|
lnrpc_fee_limit["fixed_msat"] = f"{fee_limit_msat}"
|
||||||
|
|
||||||
try:
|
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(
|
r = await self.client.post(
|
||||||
url="/v1/channels/transactions",
|
url="/v1/channels/transactions",
|
||||||
json={"payment_request": bolt11, "fee_limit": lnrpc_fee_limit},
|
json=json_,
|
||||||
timeout=None,
|
timeout=None,
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
Loading…
Add table
Reference in a new issue