diff --git a/package-lock.json b/package-lock.json index a0c0240fe..67bebf224 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "origintrail_node", - "version": "8.0.0+hotfix.1", + "version": "8.0.0+hotfix.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "origintrail_node", - "version": "8.0.0+hotfix.1", + "version": "8.0.0+hotfix.3", "license": "ISC", "dependencies": { "@comunica/query-sparql": "^2.4.3", diff --git a/package.json b/package.json index c56db6cac..5d0449e3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "8.0.0+hotfix.1", + "version": "8.0.0+hotfix.3", "description": "OTNode V8", "main": "index.js", "type": "module", diff --git a/src/commands/blockchain-event-listener/blockchain-event-listener-command.js b/src/commands/blockchain-event-listener/blockchain-event-listener-command.js index 1b38097f5..4104e43e1 100644 --- a/src/commands/blockchain-event-listener/blockchain-event-listener-command.js +++ b/src/commands/blockchain-event-listener/blockchain-event-listener-command.js @@ -209,12 +209,12 @@ class BlockchainEventListenerCommand extends Command { } async handleParameterChangedEvent(event) { - const { blockchainId, contract, data } = event; + const { blockchain, contract, data } = event; const { parameterName, parameterValue } = JSON.parse(data); switch (contract) { case CONTRACTS.PARAMETERS_STORAGE: this.blockchainModuleManager.setContractCallCache( - blockchainId, + blockchain, CONTRACTS.PARAMETERS_STORAGE, parameterName, parameterValue, diff --git a/src/commands/protocols/common/protocol-schedule-messages-command.js b/src/commands/protocols/common/protocol-schedule-messages-command.js index 2361ffb21..fb57ad349 100644 --- a/src/commands/protocols/common/protocol-schedule-messages-command.js +++ b/src/commands/protocols/common/protocol-schedule-messages-command.js @@ -40,6 +40,7 @@ class ProtocolScheduleMessagesCommand extends Command { currentBatchNodes.length }, leftover for retry: ${currentBatchLeftoverNodes.length}`, ); + const nextCommandData = this.getNextCommandData(command); const addCommandPromises = currentBatchNodes.map(async (node) => { const commandSequence = this.protocolService.getSenderCommandSequence(node.protocol); @@ -48,7 +49,7 @@ class ProtocolScheduleMessagesCommand extends Command { sequence: commandSequence.slice(1), delay: 0, data: { - ...this.getNextCommandData(command), + ...nextCommandData, blockchain, operationId, node, diff --git a/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js b/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js index 6d4efc513..3210c2267 100644 --- a/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js +++ b/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js @@ -173,7 +173,15 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand { burned: [], }; } + } else { + // kaId is number, so transform it to range + knowledgeAssetId = { + startTokenId: knowledgeAssetId, + endTokenId: knowledgeAssetId, + burned: [], + }; } + assertionPromise = this.tripleStoreService .getAssertion( blockchain, diff --git a/src/commands/protocols/get/sender/local-get-command.js b/src/commands/protocols/get/sender/local-get-command.js index 11001d308..48969419d 100644 --- a/src/commands/protocols/get/sender/local-get-command.js +++ b/src/commands/protocols/get/sender/local-get-command.js @@ -155,7 +155,15 @@ class LocalGetCommand extends Command { burned: [], }; } + } else { + // kaId is number, so transform it to range + knowledgeAssetId = { + startTokenId: knowledgeAssetId, + endTokenId: knowledgeAssetId, + burned: [], + }; } + assertionPromise = this.tripleStoreService .getAssertion( blockchain, diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index 9e6f691ea..56395fd2b 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -6,12 +6,8 @@ class BlockchainModuleManager extends BaseModuleManager { } callImplementationFunction(blockchain, functionName, args = []) { - if (blockchain) { - if (this.getImplementation(blockchain)) { - return this.getImplementation(blockchain).module[functionName](...args); - } - } else { - return this.getImplementation().module[functionName](...args); + if (this.getImplementation(blockchain)) { + return this.getImplementation(blockchain).module[functionName](...args); } } @@ -282,6 +278,14 @@ class BlockchainModuleManager extends BaseModuleManager { tokenId, ]); } + + getImplementation(name = null) { + const keys = Object.keys(this.handlers); + if (!keys.includes(name)) { + throw new Error(`Blockchain: ${name} implementation is not enabled.`); + } + return this.handlers[name]; + } } export default BlockchainModuleManager;