From ffa1441ccd1758edb1e65b215681eb3baf066ed4 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 23 Mar 2023 13:42:06 +0900 Subject: [PATCH] Delete code detecting whether the running version of nbx fixed a bug The reason to delete this is that any version of NBX with this bug wouldn't be able to run nowadays because of another bug which would prevent NBXplorer from synching (Array size too big) --- BTCPayServer/Services/Wallets/BTCPayWallet.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/BTCPayServer/Services/Wallets/BTCPayWallet.cs b/BTCPayServer/Services/Wallets/BTCPayWallet.cs index e5384a3ed..ee3b89fb7 100644 --- a/BTCPayServer/Services/Wallets/BTCPayWallet.cs +++ b/BTCPayServer/Services/Wallets/BTCPayWallet.cs @@ -214,7 +214,6 @@ namespace BTCPayServer.Services.Wallets } return await completionSource.Task; } - bool? get_wallets_recentBugFixed = null; List dummy = new List(); public async Task> FetchTransactionHistory(DerivationStrategyBase derivationStrategyBase, int? skip = null, int? count = null, TimeSpan? interval = null) { @@ -244,10 +243,6 @@ namespace BTCPayServer.Services.Wallets else { await using var ctx = await NbxplorerConnectionFactory.OpenConnection(); - if (get_wallets_recentBugFixed is null) - { - get_wallets_recentBugFixed = await ctx.QuerySingleAsync("SELECT COUNT(*) = 1 FROM nbxv1_migrations WHERE script_name='011.FixGetWalletsRecent';"); - } var rows = await ctx.QueryAsync<(string tx_id, DateTimeOffset seen_at, string blk_id, long? blk_height, long balance_change, string asset_id, long confs)>( "SELECT r.tx_id, r.seen_at, t.blk_id, t.blk_height, r.balance_change, r.asset_id, COALESCE((SELECT height FROM get_tip('BTC')) - t.blk_height + 1, 0) AS confs " + "FROM get_wallets_recent(@wallet_id, @code, @interval, @count, @skip) r " + @@ -256,23 +251,14 @@ namespace BTCPayServer.Services.Wallets { wallet_id = NBXplorer.Client.DBUtils.nbxv1_get_wallet_id(Network.CryptoCode, derivationStrategyBase.ToString()), code = Network.CryptoCode, - count = get_wallets_recentBugFixed is true ? count : skip + count, - skip = get_wallets_recentBugFixed is true ? skip : 0, + count = count, + skip = skip, interval = interval is TimeSpan t ? t : TimeSpan.FromDays(365 * 1000) }); rows.TryGetNonEnumeratedCount(out int c); var lines = new List(c); foreach (var row in rows) { - if (get_wallets_recentBugFixed is false) - { - if (skip > 0) - { - // We skip row manually so version of nbx before 2.3.34, return the expected... Remove in a year. - skip--; - continue; - } - } lines.Add(new TransactionHistoryLine() { BalanceChange = string.IsNullOrEmpty(row.asset_id) ? Money.Satoshis(row.balance_change) : new AssetMoney(uint256.Parse(row.asset_id), row.balance_change),