From bd8e375aa521da55a065e40283deaf0447a3d1c5 Mon Sep 17 00:00:00 2001 From: kth-tw <88102592+kth-tw@users.noreply.github.com> Date: Fri, 11 Feb 2022 02:28:56 +0000 Subject: [PATCH 1/2] rename createChannelArtifact to createChannelArtifactFolder --- src/instance/bdkFile.ts | 2 +- src/service/channel.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/instance/bdkFile.ts b/src/instance/bdkFile.ts index 749b4a7c..a243e3a5 100644 --- a/src/instance/bdkFile.ts +++ b/src/instance/bdkFile.ts @@ -223,7 +223,7 @@ export default class BdkFile { fs.writeFileSync(`${this.bdkPath}/config-yaml/${channelName}Channel/configtx.yaml`, configtxYaml.getYamlString()) } - public createChannelArtifact (channelName: string) { + public createChannelArtifactFolder (channelName: string) { fs.mkdirSync(`${this.bdkPath}/channel-artifacts/${channelName}`, { recursive: true }) } diff --git a/src/service/channel.ts b/src/service/channel.ts index 6d51a9cd..43f70b1f 100644 --- a/src/service/channel.ts +++ b/src/service/channel.ts @@ -34,7 +34,7 @@ export default class Channel extends AbstractService { createChannelArtifact: async (data: ChannelCreateType) => { this.generateChannelConfigtxYaml(data) await (new FabricTools(this.config, this.infra)).convertChannelConfigtxToTx(data.channelName) - this.bdkFile.createChannelArtifact(data.channelName) + this.bdkFile.createChannelArtifactFolder(data.channelName) }, createOnInstance: async (data: ChannelCreateType): Promise => { return await (new FabricInstance(this.config, this.infra)).createChannel(data.channelName, data.orderer) @@ -88,7 +88,7 @@ export default class Channel extends AbstractService { logger.debug(`Channel Update Anchor Peer: fetch ${ChannelConfigEnum.CONFIG_BLOCK} block in ${channelName}`) - this.bdkFile.createChannelArtifact(channelName) + this.bdkFile.createChannelArtifactFolder(channelName) return await this.fetchChannelConfig(channelName, signType) }, computeUpdateConfigTx: async (dto: ChannelUpdateAnchorPeerType) => { @@ -165,19 +165,19 @@ export default class Channel extends AbstractService { fetchChannelNewestBlock: async (data: ChannelFetchBlockType): Promise => { const { orderer, outputFileName, orgType, channelName } = data - this.bdkFile.createChannelArtifact(channelName) + this.bdkFile.createChannelArtifactFolder(channelName) return await (new FabricInstance(this.config, this.infra)).fetchChannelNewestBlock(channelName, outputFileName, 'block', orderer, orgType || this.config.orgType) }, fetchChannelGenesisBlock: async (data: ChannelFetchBlockType): Promise => { const { orderer, outputFileName, channelName, orgType } = data - this.bdkFile.createChannelArtifact(channelName) + this.bdkFile.createChannelArtifactFolder(channelName) return await (new FabricInstance(this.config, this.infra)).fetchChannelBlock0(channelName, outputFileName, 'block', orderer, orgType || this.config.orgType) }, fetchChannelConfig: async (data: ChannelFetchBlockType): Promise => { const { orderer, channelName, outputFileName, orgType } = data - this.bdkFile.createChannelArtifact(channelName) + this.bdkFile.createChannelArtifactFolder(channelName) return await (new FabricInstance(this.config, this.infra)).fetchChannelConfig(channelName, outputFileName, 'block', orderer, orgType || this.config.orgType) }, } From 6c2e2225b721d7c0824ef211f7465bbfb6c018ec Mon Sep 17 00:00:00 2001 From: kth-tw <88102592+kth-tw@users.noreply.github.com> Date: Fri, 11 Feb 2022 02:29:42 +0000 Subject: [PATCH 2/2] should createChannelArtifactFolder before convertChannelConfigtxToTx --- src/service/channel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/channel.ts b/src/service/channel.ts index 43f70b1f..6869a018 100644 --- a/src/service/channel.ts +++ b/src/service/channel.ts @@ -33,8 +33,8 @@ export default class Channel extends AbstractService { return { createChannelArtifact: async (data: ChannelCreateType) => { this.generateChannelConfigtxYaml(data) - await (new FabricTools(this.config, this.infra)).convertChannelConfigtxToTx(data.channelName) this.bdkFile.createChannelArtifactFolder(data.channelName) + await (new FabricTools(this.config, this.infra)).convertChannelConfigtxToTx(data.channelName) }, createOnInstance: async (data: ChannelCreateType): Promise => { return await (new FabricInstance(this.config, this.infra)).createChannel(data.channelName, data.orderer)