diff --git a/src/commands/node/tasks.ts b/src/commands/node/tasks.ts index f89947f65..31f8de8f6 100644 --- a/src/commands/node/tasks.ts +++ b/src/commands/node/tasks.ts @@ -704,7 +704,7 @@ export class NodeCommandTasks { config.stagingDir, ); - // if directory data/upgrade/current/data/keys does not exist then use data/upgrade/current + // if directory data/upgrade/current/data/keys does not exist, then use data/upgrade/current let keyDir = `${constants.HEDERA_HAPI_PATH}/data/upgrade/current/data/keys`; if (!(await self.k8.hasDir(nodeFullyQualifiedPodName, constants.ROOT_CONTAINER, keyDir))) { keyDir = `${constants.HEDERA_HAPI_PATH}/data/upgrade/current`; diff --git a/src/core/models/genesisNetworkDataConstructor.ts b/src/core/models/genesisNetworkDataConstructor.ts index 7e68c1a0e..fb7318a3d 100644 --- a/src/core/models/genesisNetworkDataConstructor.ts +++ b/src/core/models/genesisNetworkDataConstructor.ts @@ -22,6 +22,7 @@ import {KeyManager} from '../key_manager.js'; import crypto from 'node:crypto'; import {PrivateKey} from '@hashgraph/sdk'; import * as constants from '../constants.js'; +import * as x509 from '@peculiar/x509'; export class GenesisNetworkDataConstructor { public readonly nodes: Record; @@ -43,15 +44,16 @@ export class GenesisNetworkDataConstructor { await Promise.all(this.nodeAliases.map(async nodeAlias => { const nodeKeys = await keyManager.loadSigningKey(nodeAlias, keysDir); - this.nodes[nodeAlias].gossipCaCertificate = nodeKeys.certificate.toString() - const certificate = nodeKeys.certificate.toString(); + const certPem = nodeKeys.certificate.toString() - // TODO: change parameters - const hash = crypto.createHash('sha256').update(certificate).digest('hex'); + this.nodes[nodeAlias].gossipCaCertificate = certPem - this.nodes[nodeAlias].gossipCaCertificate = certificate; - this.nodes[nodeAlias].grpcCertificateHash = hash; + const tlsCertDer = new Uint8Array(x509.PemConverter.decode(certPem)[0]); + + const grpcCertificateHash = crypto.createHash('sha384').update(tlsCertDer).digest(); + + this.nodes[nodeAlias].grpcCertificateHash = grpcCertificateHash.toString(); })) } diff --git a/src/core/models/genesisNetworkNodeDataWrapper.ts b/src/core/models/genesisNetworkNodeDataWrapper.ts index 9be3980d0..ee7c6142d 100644 --- a/src/core/models/genesisNetworkNodeDataWrapper.ts +++ b/src/core/models/genesisNetworkNodeDataWrapper.ts @@ -33,7 +33,7 @@ interface Node { export class GenesisNetworkNodeDataWrapper implements Node{ public readonly nodeId: number; - public readonly accountId: AccountId | string; + public accountId: AccountId | string; public readonly description: string; public gossipEndpoint: ServiceEndpoint; public serviceEndpoint: ServiceEndpoint; diff --git a/src/core/profile_manager.ts b/src/core/profile_manager.ts index 8cf198ce6..66cfa2d5d 100644 --- a/src/core/profile_manager.ts +++ b/src/core/profile_manager.ts @@ -507,10 +507,14 @@ export class ProfileManager { const internalIP = Templates.renderFullyQualifiedNetworkPodName(namespace, nodeAlias); const externalIP = Templates.renderFullyQualifiedNetworkSvcName(namespace, nodeAlias); - genesisNetworkData.nodes[nodeAlias].addGossipEndpoint(externalIP, +externalPort, ''); - genesisNetworkData.nodes[nodeAlias].addServiceEndpoint(internalIP, +internalPort, ''); + const nodeDataWrapper = genesisNetworkData.nodes[nodeAlias]; + nodeDataWrapper.addGossipEndpoint(externalIP, +externalPort, ''); + nodeDataWrapper.addServiceEndpoint(internalIP, +internalPort, ''); const account = nodeAccountMap.get(nodeAlias); + + nodeDataWrapper.accountId = account + if (releaseVersion.minor >= 40) { configLines.push( `address, ${nodeSeq}, ${nodeSeq}, ${nodeAlias}, ${nodeStakeAmount}, ${internalIP}, ${internalPort}, ${externalIP}, ${externalPort}, ${account}`,