Skip to content

Commit

Permalink
Merge pull request #3486 from OriginTrail/fix/local-store-add-signatu…
Browse files Browse the repository at this point in the history
…re-on-local-store

Fix local store add signature on local store
  • Loading branch information
Mihajlo-Pavlovic authored Dec 11, 2024
2 parents a103f3b + feb925b commit 095400f
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/commands/local-store/local-store-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LocalStoreCommand extends Command {
this.commandExecutor = ctx.commandExecutor;
this.repositoryModuleManager = ctx.repositoryModuleManager;
this.blsService = ctx.blsService;
this.signatureStorageService = ctx.signatureStorageService;

this.errorType = ERROR_TYPE.LOCAL_STORE.LOCAL_STORE_ERROR;
}
Expand Down Expand Up @@ -55,32 +56,21 @@ class LocalStoreCommand extends Command {
);

if (storeType === LOCAL_STORE_TYPES.TRIPLE) {
const storePromises = [];

// if (cachedData.dataset && cachedData.datasetRoot) {
// storePromises.push(
// this.pendingStorageService.cacheDataset(
// operationId,
// cachedData.datasetRoot,
// cachedData.dataset,
// ),
// );
// }
// if (cachedData.private?.assertion && cachedData.private?.assertionId) {
// storePromises.push(
// this.pendingStorageService.cacheDataset(operationId, datasetRoot, dataset),
// );
// }
await Promise.all(storePromises);
this.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.LOCAL_STORE.LOCAL_STORE_PROCESS_RESPONSE_START,
operationId,
blockchain,
);

const identityId = await this.blockchainModuleManager.getIdentityId(blockchain);
const signature = await this.blsService.sign(datasetRoot);

this.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.LOCAL_STORE.LOCAL_STORE_PROCESS_RESPONSE_START,
await this.signatureStorageService.addSignatureToStorage(
operationId,
blockchain,
identityId,
signature,
);

await this.operationService.processResponse(
command,
OPERATION_REQUEST_STATUS.COMPLETED,
Expand Down

0 comments on commit 095400f

Please sign in to comment.