From ada08f44b8833340593def9a744578281b8e5cfb Mon Sep 17 00:00:00 2001 From: Dhruv Bhanushali <119250923+theDRB123@users.noreply.github.com> Date: Wed, 21 Aug 2024 21:45:59 +0530 Subject: [PATCH] Fixed Tasks in Postgre-BlockRewindOperation --- .../Storage/Postgres/BlockRewindOperation.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Blockcore.Indexer.Core/Storage/Postgres/BlockRewindOperation.cs b/src/Blockcore.Indexer.Core/Storage/Postgres/BlockRewindOperation.cs index ce35deb..92fc692 100644 --- a/src/Blockcore.Indexer.Core/Storage/Postgres/BlockRewindOperation.cs +++ b/src/Blockcore.Indexer.Core/Storage/Postgres/BlockRewindOperation.cs @@ -22,9 +22,9 @@ public async Task RewindBlockAsync(uint blockIndex) await StoreRewindBlockAsync(contextFactory, blockIndex); - Task Outputs = Task.Run(async () => await contextFactory.CreateDbContext().Outputs.Where(o => o.Outpoint.OutputIndex == blockIndex).ExecuteDeleteAsync()); - Task AddressComputed = Task.Run(async () => await contextFactory.CreateDbContext().AddressComputedTable.Where(t => t.ComputedBlockIndex == blockIndex).ExecuteDeleteAsync()); - Task AddressHistory = Task.Run(async () => await contextFactory.CreateDbContext().AddressHistoryComputedTable.Where(t => t.BlockIndex == blockIndex).ExecuteDeleteAsync()); + Task Outputs = contextFactory.CreateDbContext().Outputs.Where(o => o.Outpoint.OutputIndex == blockIndex).ExecuteDeleteAsync(); + Task AddressComputed = contextFactory.CreateDbContext().AddressComputedTable.Where(t => t.ComputedBlockIndex == blockIndex).ExecuteDeleteAsync(); + Task AddressHistory = contextFactory.CreateDbContext().AddressHistoryComputedTable.Where(t => t.BlockIndex == blockIndex).ExecuteDeleteAsync(); await Task.WhenAll(Outputs, AddressComputed, AddressHistory); @@ -33,9 +33,9 @@ public async Task RewindBlockAsync(uint blockIndex) await MergeRewindInputsToUnspentTransactionsAsync(blockIndex); - Task Block = Task.Run(async () => await contextFactory.CreateDbContext().Blocks.Where(b => b.BlockIndex == blockIndex).ExecuteDeleteAsync()); + Task Block = contextFactory.CreateDbContext().Blocks.Where(b => b.BlockIndex == blockIndex).ExecuteDeleteAsync(); - Task Utxo = Task.Run(async () => await contextFactory.CreateDbContext().unspentOutputs.Where(utxo => utxo.BlockIndex == blockIndex).ExecuteDeleteAsync()); + Task Utxo = contextFactory.CreateDbContext().unspentOutputs.Where(utxo => utxo.BlockIndex == blockIndex).ExecuteDeleteAsync(); await Task.WhenAll(Block, Utxo); }