Update lightning lib, on-chain balance shouldn't be lightmoney (#3945)

This commit is contained in:
Nicolas Dorier 2022-07-08 10:55:26 +09:00 committed by GitHub
parent a41e98910d
commit eec54831ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 22 additions and 21 deletions

View file

@ -28,7 +28,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.3.7" />
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.3.8" />
<PackageReference Include="NBitcoin" Version="7.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

View file

@ -1,5 +1,6 @@
using BTCPayServer.Client.JsonConverters;
using BTCPayServer.Lightning;
using NBitcoin;
using Newtonsoft.Json;
namespace BTCPayServer.Client.Models
@ -25,14 +26,14 @@ namespace BTCPayServer.Client.Models
public class OnchainBalanceData
{
[JsonConverter(typeof(LightMoneyJsonConverter))]
public LightMoney Confirmed { get; set; }
[JsonConverter(typeof(JsonConverters.MoneyJsonConverter))]
public Money Confirmed { get; set; }
[JsonConverter(typeof(JsonConverters.MoneyJsonConverter))]
public Money Unconfirmed { get; set; }
[JsonConverter(typeof(LightMoneyJsonConverter))]
public LightMoney Unconfirmed { get; set; }
[JsonConverter(typeof(LightMoneyJsonConverter))]
public LightMoney Reserved { get; set; }
[JsonConverter(typeof(JsonConverters.MoneyJsonConverter))]
public Money Reserved { get; set; }
}
public class OffchainBalanceData

View file

@ -48,7 +48,7 @@
<ItemGroup>
<PackageReference Include="BIP78.Sender" Version="0.2.2" />
<PackageReference Include="BTCPayServer.Hwi" Version="2.0.2" />
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.3.11" />
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.3.12" />
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="BundlerMinifier.Core" Version="3.2.435" />
<PackageReference Include="BundlerMinifier.TagHelpers" Version="3.2.435" />

View file

@ -61,8 +61,8 @@ public class StoreLightningBalance : ViewComponent
var balance = await lightningClient.GetBalance();
vm.Balance = balance;
vm.TotalOnchain = balance.OnchainBalance != null
? (balance.OnchainBalance.Confirmed?? 0) + (balance.OnchainBalance.Reserved ?? 0) +
(balance.OnchainBalance.Unconfirmed ?? 0)
? (balance.OnchainBalance.Confirmed?? 0L) + (balance.OnchainBalance.Reserved ?? 0L) +
(balance.OnchainBalance.Unconfirmed ?? 0L)
: null;
vm.TotalOffchain = balance.OffchainBalance != null
? (balance.OffchainBalance.Opening?? 0) + (balance.OffchainBalance.Local?? 0) +

View file

@ -1,6 +1,7 @@
using BTCPayServer.Data;
using BTCPayServer.Lightning;
using BTCPayServer.Services.Rates;
using NBitcoin;
namespace BTCPayServer.Components.StoreLightningBalance;
@ -10,7 +11,7 @@ public class StoreLightningBalanceViewModel
public string DefaultCurrency { get; set; }
public CurrencyData CurrencyData { get; set; }
public StoreData Store { get; set; }
public LightMoney TotalOnchain { get; set; }
public Money TotalOnchain { get; set; }
public LightMoney TotalOffchain { get; set; }
public LightningNodeBalance Balance { get; set; }
public string ProblemDescription { get; set; }

View file

@ -75,7 +75,7 @@ namespace BTCPayServer
CreationStore.Remove(userId, out _);
return true;
}
catch (Exception e)
catch (Exception)
{
return false;
}

View file

@ -114,7 +114,7 @@ namespace BTCPayServer.Controllers
assetBalance.FormattedFiatValue = _currencyNameTable.DisplayFormatCurrency(pair.Value.Qty * quote.Bid, pair.Value.FiatAsset);
assetBalance.TradableAssetPairs = tradableAssetPairs.Where(o => o.AssetBought == asset || o.AssetSold == asset);
}
catch (WrongTradingPairException e)
catch (WrongTradingPairException)
{
// Cannot trade this asset, just ignore
}

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using BTCPayServer.Client.Models;
using BTCPayServer.Data;
using BTCPayServer.Data;
using BTCPayServer.Payments;
using BTCPayServer.Payments.Bitcoin;
using BTCPayServer.Services.Invoices;

View file

@ -68,6 +68,6 @@ namespace BTCPayServer.Models.InvoicingModels
public bool RedirectAutomatically { get; set; }
public bool Activated { get; set; }
public string InvoiceCurrency { get; set; }
public string? ReceiptLink { get; set; }
public string ReceiptLink { get; set; }
}
}

View file

@ -219,17 +219,17 @@
"properties": {
"confirmed": {
"type": "string",
"description": "The confirmed amount in millisatoshi",
"description": "The confirmed amount in satoshi",
"nullable": true
},
"unconfirmed": {
"type": "string",
"description": "The unconfirmed amount in millisatoshi",
"description": "The unconfirmed amount in satoshi",
"nullable": true
},
"reserved": {
"type": "string",
"description": "The reserved amount in millisatoshi",
"description": "The reserved amount in satoshi",
"nullable": true
}
}

View file

@ -56,9 +56,9 @@ public class FakeCustodian : ICustodian
return Task.FromResult(form);
}
private FakeCustodianConfig? ParseConfig(JObject config)
private FakeCustodianConfig ParseConfig(JObject config)
{
return config?.ToObject<FakeCustodianConfig>();
return config?.ToObject<FakeCustodianConfig>() ?? throw new InvalidOperationException("Invalid config");
}
}