-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2854 from OriginTrail/v6/prerelease/mainnet
OriginTrail Mainnet Release v6.1.1
- Loading branch information
Showing
6 changed files
with
91 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/migration/mark-staking-events-as-processed-migration.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* eslint-disable no-await-in-loop */ | ||
import BaseMigration from './base-migration.js'; | ||
|
||
class MarkStakingEventsAsProcessedMigration extends BaseMigration { | ||
constructor(migrationName, logger, config, repositoryModuleManager, blockchainModuleManager) { | ||
super(migrationName, logger, config); | ||
this.repositoryModuleManager = repositoryModuleManager; | ||
this.blockchainModuleManager = blockchainModuleManager; | ||
} | ||
|
||
async executeMigration() { | ||
this.logger.info('Marking old blockchain events as processed'); | ||
for (const blockchain of this.blockchainModuleManager.getImplementationNames()) { | ||
const timestamp = Date.now(); | ||
const block = await this.blockchainModuleManager.getLatestBlock(blockchain); | ||
const query = `update blockchain | ||
set last_checked_block = ${block.number}, | ||
last_checked_timestamp = ${timestamp} | ||
where blockchain_id = 'otp:2043'`; | ||
await this.repositoryModuleManager.query(query); | ||
} | ||
} | ||
} | ||
|
||
export default MarkStakingEventsAsProcessedMigration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters