Lightning: Allow LND to be used with non-admin macaroons (#5567)

* Lightning: Allow LND to be used with non-admin macaroons

Requires btcpayserver/BTCPayServer.Lightning#152.

* Upgrade Lightning lib
This commit is contained in:
d11n 2023-12-20 11:23:46 +01:00 committed by GitHub
parent 61bf6d33b2
commit 93ab219124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -50,7 +50,7 @@
<PackageReference Include="YamlDotNet" Version="8.0.0" />
<PackageReference Include="BIP78.Sender" Version="0.2.2" />
<PackageReference Include="BTCPayServer.Hwi" Version="2.0.2" />
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.5.2" />
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.5.3" />
<PackageReference Include="CsvHelper" Version="15.0.5" />
<PackageReference Include="Dapper" Version="2.1.24" />
<PackageReference Include="Fido2" Version="2.0.2" />

View File

@ -61,7 +61,7 @@ namespace BTCPayServer.Payments.Lightning
if (preparePaymentObject is null)
{
return new LightningLikePaymentMethodDetails()
return new LightningLikePaymentMethodDetails
{
Activated = false
};
@ -144,6 +144,12 @@ namespace BTCPayServer.Payments.Lightning
}
catch (NotSupportedException)
{
// LNDhub, LNbits and others might not support this call, yet we can create invoices.
return new NodeInfo[] {};
}
catch (UnauthorizedAccessException)
{
// LND might return this with restricted macaroon, support this nevertheless..
return new NodeInfo[] {};
}
catch (Exception ex)
@ -237,7 +243,7 @@ namespace BTCPayServer.Payments.Lightning
public override CheckoutUIPaymentMethodSettings GetCheckoutUISettings()
{
return new CheckoutUIPaymentMethodSettings()
return new CheckoutUIPaymentMethodSettings
{
ExtensionPartial = "Lightning/LightningLikeMethodCheckout",
CheckoutBodyVueComponentName = "LightningLikeMethodCheckout",

View File

@ -156,11 +156,13 @@
</li>
</ul>
<p>
For the macaroon options you need to provide the <code>admin.macaroon</code>.<br/>
For the macaroon options you need to provide a macaroon with the <code>invoices:write</code> permission (e.g. <code>invoice.macaroon</code>, see
<a href="https://docs.lightning.engineering/lightning-network-tools/lnd/macaroons" target="_blank" rel="noreferrer noopener">details</a>). If you
want to display the node connection details, it also needs the <code>info:read</code> permission.<br/>
The path to the LND data directory may vary, the following examples assume <code>/root/.lnd</code>.
</p>
<p class="mb-2">The <code>macaroon</code> parameter expects the HEX value, it can be obtained using this command:</p>
<pre class="mb-4">xxd -p -c 256 /root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'</pre>
<pre class="mb-4">xxd -p -c 256 /root/.lnd/data/chain/bitcoin/mainnet/invoice.macaroon | tr -d '\n'</pre>
<p class="mb-2">
You can omit <code>certthumbprint</code> if the certificate is trusted by your machine.<br/>
The <code>certthumbprint</code> can be obtained using this command: