mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Show warning when enabling Payjoin but supported payment methods are not using a hot wallet (#1545)
* Show warning when enabling Payjoin but supported payment methods are not using a hot wallet https://i.imgur.com/RXBhr0n.png fixes #1474 * expose p2p port
This commit is contained in:
@@ -127,6 +127,7 @@ services:
|
|||||||
deprecatedrpc=signrawtransaction
|
deprecatedrpc=signrawtransaction
|
||||||
ports:
|
ports:
|
||||||
- "43782:43782"
|
- "43782:43782"
|
||||||
|
- "39388:39388"
|
||||||
expose:
|
expose:
|
||||||
- "43782" # RPC
|
- "43782" # RPC
|
||||||
- "39388" # P2P
|
- "39388" # P2P
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using NBitcoin.DataEncoders;
|
using NBitcoin.DataEncoders;
|
||||||
|
using NBXplorer;
|
||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
@@ -545,6 +546,7 @@ namespace BTCPayServer.Controllers
|
|||||||
Provider = "CoinSwitch"
|
Provider = "CoinSwitch"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("{storeId}")]
|
[Route("{storeId}")]
|
||||||
@@ -574,6 +576,7 @@ namespace BTCPayServer.Controllers
|
|||||||
blob.InvoiceExpiration = model.InvoiceExpiration;
|
blob.InvoiceExpiration = model.InvoiceExpiration;
|
||||||
blob.LightningDescriptionTemplate = model.LightningDescriptionTemplate ?? string.Empty;
|
blob.LightningDescriptionTemplate = model.LightningDescriptionTemplate ?? string.Empty;
|
||||||
blob.PaymentTolerance = model.PaymentTolerance;
|
blob.PaymentTolerance = model.PaymentTolerance;
|
||||||
|
var payjoinChanged = blob.PayJoinEnabled != model.PayJoinEnabled;
|
||||||
blob.PayJoinEnabled = model.PayJoinEnabled;
|
blob.PayJoinEnabled = model.PayJoinEnabled;
|
||||||
if (CurrentStore.SetStoreBlob(blob))
|
if (CurrentStore.SetStoreBlob(blob))
|
||||||
{
|
{
|
||||||
@@ -583,7 +586,31 @@ namespace BTCPayServer.Controllers
|
|||||||
if (needUpdate)
|
if (needUpdate)
|
||||||
{
|
{
|
||||||
await _Repo.UpdateStore(CurrentStore);
|
await _Repo.UpdateStore(CurrentStore);
|
||||||
|
|
||||||
TempData[WellKnownTempData.SuccessMessage] = "Store successfully updated";
|
TempData[WellKnownTempData.SuccessMessage] = "Store successfully updated";
|
||||||
|
|
||||||
|
if (payjoinChanged && blob.PayJoinEnabled)
|
||||||
|
{
|
||||||
|
var problematicPayjoinEnabledMethods = CurrentStore.GetSupportedPaymentMethods(_NetworkProvider)
|
||||||
|
.OfType<DerivationSchemeSettings>()
|
||||||
|
.Where(settings =>
|
||||||
|
settings.Network.SupportPayJoin &&
|
||||||
|
string.IsNullOrEmpty(_ExplorerProvider.GetExplorerClient(settings.Network)
|
||||||
|
.GetMetadata<string>(settings.AccountDerivation,
|
||||||
|
WellknownMetadataKeys.Mnemonic)))
|
||||||
|
.Select(settings => settings.PaymentId.CryptoCode)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
if (problematicPayjoinEnabledMethods.Any())
|
||||||
|
{
|
||||||
|
TempData.Remove(WellKnownTempData.SuccessMessage);
|
||||||
|
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||||
|
{
|
||||||
|
Severity = StatusMessageModel.StatusSeverity.Warning,
|
||||||
|
Html = $"The store was updated successfully. However, payjoin will not work for {string.Join(", ", problematicPayjoinEnabledMethods)} until you configure them to be a <a href='https://docs.btcpayserver.org/features/wallet/hotwallet' class='alert-link' target='_blank'>hot wallet</a>."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction(nameof(UpdateStore), new
|
return RedirectToAction(nameof(UpdateStore), new
|
||||||
|
|||||||
Reference in New Issue
Block a user