mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-15 12:20:16 +01:00
Replace pruning wallet by wipe transactions (#2857)
This commit is contained in:
parent
039f88d14c
commit
89fd044b00
3 changed files with 22 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Import Project="../Build/Version.csproj" Condition="Exists('../Build/Version.csproj')" />
|
<Import Project="../Build/Version.csproj" Condition="Exists('../Build/Version.csproj')" />
|
||||||
<Import Project="../Build/Common.csproj" />
|
<Import Project="../Build/Common.csproj" />
|
||||||
|
|
||||||
|
|
|
@ -1169,8 +1169,7 @@ namespace BTCPayServer.Controllers
|
||||||
}
|
}
|
||||||
else if (command == "prune")
|
else if (command == "prune")
|
||||||
{
|
{
|
||||||
var result = await ExplorerClientProvider.GetExplorerClient(walletId.CryptoCode)
|
var result = await ExplorerClientProvider.GetExplorerClient(walletId.CryptoCode).PruneAsync(derivationScheme.AccountDerivation, new PruneRequest(), cancellationToken);
|
||||||
.PruneAsync(derivationScheme.AccountDerivation, new PruneRequest(), cancellationToken);
|
|
||||||
if (result.TotalPruned == 0)
|
if (result.TotalPruned == 0)
|
||||||
{
|
{
|
||||||
TempData[WellKnownTempData.SuccessMessage] = $"The wallet is already pruned";
|
TempData[WellKnownTempData.SuccessMessage] = $"The wallet is already pruned";
|
||||||
|
@ -1183,6 +1182,21 @@ namespace BTCPayServer.Controllers
|
||||||
|
|
||||||
return RedirectToAction(nameof(WalletSettings));
|
return RedirectToAction(nameof(WalletSettings));
|
||||||
}
|
}
|
||||||
|
else if (command == "clear" && User.IsInRole(Roles.ServerAdmin))
|
||||||
|
{
|
||||||
|
if (Version.TryParse(_dashboard.Get(walletId.CryptoCode)?.Status?.Version ?? "0.0.0.0", out var v) &&
|
||||||
|
v < new Version(2, 2, 4))
|
||||||
|
{
|
||||||
|
TempData[WellKnownTempData.ErrorMessage] = $"This version of NBXplorer doesn't support this operation, please upgrade to 2.2.4 or above";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await ExplorerClientProvider.GetExplorerClient(walletId.CryptoCode)
|
||||||
|
.WipeAsync(derivationScheme.AccountDerivation, cancellationToken);
|
||||||
|
TempData[WellKnownTempData.SuccessMessage] = $"The transactions have been wiped out, to restore your balance, rescan the wallet.";
|
||||||
|
}
|
||||||
|
return RedirectToAction(nameof(WalletSettings));
|
||||||
|
}
|
||||||
else if (command == "view-seed" && await CanUseHotWallet())
|
else if (command == "view-seed" && await CanUseHotWallet())
|
||||||
{
|
{
|
||||||
if (await GetSeed(walletId, derivationScheme.Network) != null)
|
if (await GetSeed(walletId, derivationScheme.Network) != null)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@using Newtonsoft.Json
|
@using Newtonsoft.Json
|
||||||
@using System.Text
|
@using System.Text
|
||||||
@using NBitcoin.DataEncoders
|
@using NBitcoin.DataEncoders
|
||||||
@model WalletSettingsViewModel
|
@model WalletSettingsViewModel
|
||||||
|
@ -71,6 +71,10 @@
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu" aria-labelledby="OtherActionsDropdownToggle">
|
<div class="dropdown-menu" aria-labelledby="OtherActionsDropdownToggle">
|
||||||
<button name="command" type="submit" class="dropdown-item" value="prune">Prune old transactions from history</button>
|
<button name="command" type="submit" class="dropdown-item" value="prune">Prune old transactions from history</button>
|
||||||
|
@if (User.IsInRole(Roles.ServerAdmin))
|
||||||
|
{
|
||||||
|
<button name="command" type="submit" class="dropdown-item" value="clear">Clear all transactions from history</button>
|
||||||
|
}
|
||||||
@if (Model.NBXSeedAvailable)
|
@if (Model.NBXSeedAvailable)
|
||||||
{
|
{
|
||||||
<button name="command" type="submit" class="dropdown-item" value="view-seed">View seed</button>
|
<button name="command" type="submit" class="dropdown-item" value="view-seed">View seed</button>
|
||||||
|
|
Loading…
Add table
Reference in a new issue