Skip to content

Commit

Permalink
Merge pull request #2570 from OriginTrail/v6/prerelease/mainnet
Browse files Browse the repository at this point in the history
Mainnet 6.0.10 Release
  • Loading branch information
zeroxbt authored Jun 2, 2023
2 parents 15905fa + 615bad5 commit 9bdd737
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "6.0.9",
"version": "6.0.10",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ class ShardRepository {
);
}

async removePeerRecords(peerRecords) {
await this.model.bulkDestroy(peerRecords);
async removePeerRecord(blockchainId, peerId) {
await this.model.destroy({
where: {
blockchainId,
peerId,
},
});
}

async cleanShardingTable(blockchainId) {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/repository/repository-module-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class RepositoryModuleManager extends BaseModuleManager {
return this.getRepository('shard').getPeersToDial(limit, dialFrequencyMillis);
}

async removePeerRecords(peerRecords) {
return this.getRepository('shard').removePeerRecords(peerRecords);
async removePeerRecord(blockchain, peerId) {
return this.getRepository('shard').removePeerRecord(blockchain, peerId);
}

async updatePeerRecordLastDialed(peerId, timestamp) {
Expand Down
10 changes: 3 additions & 7 deletions src/service/blockchain-event-listener-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class BlockchainEventListenerService {
}

async handleNodeRemovedEvents(blockEvents) {
const peerRecords = await Promise.all(
await Promise.all(
blockEvents.map(async (event) => {
const eventData = JSON.parse(event.data);

Expand All @@ -292,14 +292,10 @@ class BlockchainEventListenerService {
);

this.logger.trace(`Removing peer id: ${nodeId} from sharding table.`);
return {
peerId: nodeId,
blockchainId: event.blockchainId,
};

this.repositoryModuleManager.removePeerRecord(event.blockchainId, nodeId);
}),
);

await this.repositoryModuleManager.removePeerRecords(peerRecords);
}

async handleStakeIncreasedEvents(blockEvents) {
Expand Down

0 comments on commit 9bdd737

Please sign in to comment.