From e06f0eb112189236163b46f85899506da073f450 Mon Sep 17 00:00:00 2001 From: webwarrior Date: Mon, 15 Jul 2024 14:40:50 +0200 Subject: [PATCH] Backend: upgrade NBitcoin to version 7.0.13 Updated NBitcoin to version 7.0.13 because older NBitcoin versions can't decode bech32 strings of length > 90, which is needed for Silent Payment address decoding. Since UnknowParameters property of BitcoinUrlBuilder is deprecated in new version, use UnknownParameters instead. As return type of new property is different, had to change some code. --- .../GWallet.Backend.Tests-legacy.fsproj | 2 +- src/GWallet.Backend.Tests/packages.config | 2 +- src/GWallet.Backend/GWallet.Backend-legacy.fsproj | 2 +- src/GWallet.Backend/GWallet.Backend.fsproj | 2 +- src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs | 7 ++++--- src/GWallet.Backend/packages.config | 2 +- .../GWallet.Frontend.XF.Android.fsproj | 2 +- src/GWallet.Frontend.XF.Android/packages.config | 2 +- src/GWallet.Frontend.XF.Gtk/GWallet.Frontend.XF.Gtk.fsproj | 2 +- src/GWallet.Frontend.XF.Gtk/packages.config | 2 +- src/GWallet.Frontend.XF.Mac/GWallet.Frontend.XF.Mac.fsproj | 2 +- src/GWallet.Frontend.XF.Mac/packages.config | 2 +- src/GWallet.Frontend.XF.iOS/GWallet.Frontend.XF.iOS.fsproj | 2 +- src/GWallet.Frontend.XF.iOS/packages.config | 2 +- 14 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/GWallet.Backend.Tests/GWallet.Backend.Tests-legacy.fsproj b/src/GWallet.Backend.Tests/GWallet.Backend.Tests-legacy.fsproj index a5ddab212..9c15f6534 100644 --- a/src/GWallet.Backend.Tests/GWallet.Backend.Tests-legacy.fsproj +++ b/src/GWallet.Backend.Tests/GWallet.Backend.Tests-legacy.fsproj @@ -124,7 +124,7 @@ ..\..\packages\Microsoft.Extensions.Logging.Abstractions.1.0.2\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll - ..\..\packages\NBitcoin.6.0.17\lib\net461\NBitcoin.dll + ..\..\packages\NBitcoin.7.0.13\lib\netstandard2.0\NBitcoin.dll ..\..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll diff --git a/src/GWallet.Backend.Tests/packages.config b/src/GWallet.Backend.Tests/packages.config index db38c0fe3..96d14f7ff 100644 --- a/src/GWallet.Backend.Tests/packages.config +++ b/src/GWallet.Backend.Tests/packages.config @@ -3,7 +3,7 @@ - + diff --git a/src/GWallet.Backend/GWallet.Backend-legacy.fsproj b/src/GWallet.Backend/GWallet.Backend-legacy.fsproj index 7f6b17334..6ba4638dc 100644 --- a/src/GWallet.Backend/GWallet.Backend-legacy.fsproj +++ b/src/GWallet.Backend/GWallet.Backend-legacy.fsproj @@ -173,7 +173,7 @@ ..\..\packages\NBitcoin.Altcoins.3.0.8\lib\net452\NBitcoin.Altcoins.dll - ..\..\packages\NBitcoin.6.0.17\lib\net461\NBitcoin.dll + ..\..\packages\NBitcoin.7.0.13\lib\netstandard2.0\NBitcoin.dll ..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll diff --git a/src/GWallet.Backend/GWallet.Backend.fsproj b/src/GWallet.Backend/GWallet.Backend.fsproj index 75e953bc2..251beb357 100644 --- a/src/GWallet.Backend/GWallet.Backend.fsproj +++ b/src/GWallet.Backend/GWallet.Backend.fsproj @@ -62,7 +62,7 @@ - + diff --git a/src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs b/src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs index 6adb43f4c..56e8f0e4a 100644 --- a/src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs +++ b/src/GWallet.Backend/UtxoCoin/UtxoCoinAccount.fs @@ -580,8 +580,10 @@ module Account = } } - let MaybeReportWarningsForUnknownParameters addressOrUrl (unknownParams: System.Collections.Generic.Dictionary) = + let MaybeReportWarningsForUnknownParameters addressOrUrl (unknownParams: System.Collections.Generic.IReadOnlyDictionary) = if not (isNull unknownParams) && unknownParams.Any() then + // convert unknownParams to mutable dictionary since we may have to remove keys from it + let unknownParams = dict <| seq { for pair in unknownParams -> pair.Key, pair.Value } let unknownToUs = @@ -607,8 +609,7 @@ module Account = if addressOrUrl.StartsWith "bitcoin:" || addressOrUrl.StartsWith "litecoin:" then let uriBuilder = BitcoinUrlBuilder (addressOrUrl, network) - // FIXME: fix typo "UnknowParameters" in NBitcoin - MaybeReportWarningsForUnknownParameters addressOrUrl uriBuilder.UnknowParameters + MaybeReportWarningsForUnknownParameters addressOrUrl uriBuilder.UnknownParameters if null = uriBuilder.Address then failwith <| SPrintF1 "Address started with 'bitcoin:' but an address could not be extracted: %s" addressOrUrl diff --git a/src/GWallet.Backend/packages.config b/src/GWallet.Backend/packages.config index 57f204703..2c7f70ed9 100644 --- a/src/GWallet.Backend/packages.config +++ b/src/GWallet.Backend/packages.config @@ -12,7 +12,7 @@ - + diff --git a/src/GWallet.Frontend.XF.Android/GWallet.Frontend.XF.Android.fsproj b/src/GWallet.Frontend.XF.Android/GWallet.Frontend.XF.Android.fsproj index 7be4ac652..68521d24c 100644 --- a/src/GWallet.Frontend.XF.Android/GWallet.Frontend.XF.Android.fsproj +++ b/src/GWallet.Frontend.XF.Android/GWallet.Frontend.XF.Android.fsproj @@ -296,7 +296,7 @@ ..\..\packages\Microsoft.Extensions.Logging.Abstractions.1.0.2\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll - ..\..\packages\NBitcoin.6.0.17\lib\netstandard2.1\NBitcoin.dll + ..\..\packages\NBitcoin.7.0.13\lib\netstandard2.1\NBitcoin.dll ..\..\packages\NBitcoin.Altcoins.3.0.8\lib\netstandard2.1\NBitcoin.Altcoins.dll diff --git a/src/GWallet.Frontend.XF.Android/packages.config b/src/GWallet.Frontend.XF.Android/packages.config index ed414b2f5..a247ba8da 100644 --- a/src/GWallet.Frontend.XF.Android/packages.config +++ b/src/GWallet.Frontend.XF.Android/packages.config @@ -13,7 +13,7 @@ - + diff --git a/src/GWallet.Frontend.XF.Gtk/GWallet.Frontend.XF.Gtk.fsproj b/src/GWallet.Frontend.XF.Gtk/GWallet.Frontend.XF.Gtk.fsproj index 52f892ff8..115960860 100644 --- a/src/GWallet.Frontend.XF.Gtk/GWallet.Frontend.XF.Gtk.fsproj +++ b/src/GWallet.Frontend.XF.Gtk/GWallet.Frontend.XF.Gtk.fsproj @@ -105,7 +105,7 @@ ..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - ..\..\packages\NBitcoin.6.0.17\lib\net461\NBitcoin.dll + ..\..\packages\NBitcoin.7.0.13\lib\netstandard2.0\NBitcoin.dll ..\..\packages\NBitcoin.Altcoins.3.0.8\lib\net452\NBitcoin.Altcoins.dll diff --git a/src/GWallet.Frontend.XF.Gtk/packages.config b/src/GWallet.Frontend.XF.Gtk/packages.config index 1c71f0d3d..fb606e102 100644 --- a/src/GWallet.Frontend.XF.Gtk/packages.config +++ b/src/GWallet.Frontend.XF.Gtk/packages.config @@ -11,7 +11,7 @@ - + diff --git a/src/GWallet.Frontend.XF.Mac/GWallet.Frontend.XF.Mac.fsproj b/src/GWallet.Frontend.XF.Mac/GWallet.Frontend.XF.Mac.fsproj index 5ac3645ff..7ee55cb45 100644 --- a/src/GWallet.Frontend.XF.Mac/GWallet.Frontend.XF.Mac.fsproj +++ b/src/GWallet.Frontend.XF.Mac/GWallet.Frontend.XF.Mac.fsproj @@ -84,7 +84,7 @@ ..\..\packages\System.Buffers.4.5.1\lib\netstandard2.0\System.Buffers.dll - ..\..\packages\NBitcoin.6.0.17\lib\netstandard2.1\NBitcoin.dll + ..\..\packages\NBitcoin.7.0.13\lib\netstandard2.1\NBitcoin.dll ..\..\packages\NBitcoin.Altcoins.3.0.8\lib\netstandard2.1\NBitcoin.Altcoins.dll diff --git a/src/GWallet.Frontend.XF.Mac/packages.config b/src/GWallet.Frontend.XF.Mac/packages.config index 01e1ff1c8..11ce821dd 100644 --- a/src/GWallet.Frontend.XF.Mac/packages.config +++ b/src/GWallet.Frontend.XF.Mac/packages.config @@ -11,7 +11,7 @@ - + diff --git a/src/GWallet.Frontend.XF.iOS/GWallet.Frontend.XF.iOS.fsproj b/src/GWallet.Frontend.XF.iOS/GWallet.Frontend.XF.iOS.fsproj index e56b07ff6..e5be8e82d 100644 --- a/src/GWallet.Frontend.XF.iOS/GWallet.Frontend.XF.iOS.fsproj +++ b/src/GWallet.Frontend.XF.iOS/GWallet.Frontend.XF.iOS.fsproj @@ -198,7 +198,7 @@ ..\..\packages\System.Buffers.4.5.1\lib\netstandard2.0\System.Buffers.dll - ..\..\packages\NBitcoin.6.0.17\lib\netstandard2.1\NBitcoin.dll + ..\..\packages\NBitcoin.7.0.13\lib\netstandard2.1\NBitcoin.dll ..\..\packages\NBitcoin.Altcoins.3.0.8\lib\netstandard2.1\NBitcoin.Altcoins.dll diff --git a/src/GWallet.Frontend.XF.iOS/packages.config b/src/GWallet.Frontend.XF.iOS/packages.config index d5e66a030..5d4608a87 100644 --- a/src/GWallet.Frontend.XF.iOS/packages.config +++ b/src/GWallet.Frontend.XF.iOS/packages.config @@ -12,7 +12,7 @@ - +