Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Tasks in Postgre-BlockRewindOperation #218

Open
wants to merge 1 commit into
base: Adding-postgre-sql-support
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down