-
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.
OriginTrail Mainnet Prerelease v6.1.1 (#2853)
* Upp sharding table migration enabled * Update event insert in chunks * version bump * Add migration for makring staking events as processed * Updated migration executor added mark staking events as processed migration * Updated migration added await on get latest block * Updated migration for all contracts * Migration updated --------- Co-authored-by: NZT48 <[email protected]>
- Loading branch information
1 parent
50986af
commit c989523
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