mirror of
https://github.com/mempool/mempool.git
synced 2026-08-13 12:33:11 +02:00
Don't delete transactions when checking if the current chain is valid
This commit is contained in:
parent
a0d116c069
commit
fe3059fbb0
2 changed files with 0 additions and 18 deletions
|
|
@ -575,7 +575,6 @@ class BlocksRepository {
|
|||
if (blocks[idx].previous_block_hash !== blocks[idx - 1].hash) {
|
||||
logger.warn(`Chain divergence detected at block ${blocks[idx - 1].height}`);
|
||||
await this.$deleteBlocksFrom(blocks[idx - 1].height);
|
||||
await BlocksSummariesRepository.$deleteTransactionsFrom(blocks[idx - 1].height);
|
||||
await HashratesRepository.$deleteHashratesFromTimestamp(blocks[idx - 1].timestamp - 604800);
|
||||
await DifficultyAdjustmentsRepository.$deleteAdjustementsFromHeight(blocks[idx - 1].height);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -82,23 +82,6 @@ class BlocksSummariesRepository {
|
|||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete blocks from the database from blockHeight
|
||||
*/
|
||||
public async $deleteTransactionsFrom(blockHeight: number): Promise<void> {
|
||||
logger.info(`Delete blocks summaries transactions from height ${blockHeight} from the database, but keep templates`, logger.tags.mining);
|
||||
|
||||
try {
|
||||
await DB.query(`
|
||||
UPDATE blocks_summaries
|
||||
SET transactions = '[]'
|
||||
WHERE height >= ${blockHeight}
|
||||
`);
|
||||
} catch (e) {
|
||||
logger.err('Cannot delete blocks summaries transactions. Reason: ' + (e instanceof Error ? e.message : e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fee percentiles if the block has already been indexed, [] otherwise
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue