@@ -24,12 +24,6 @@ import dot from 'dot-object'
24
24
import { getNodeAccountMap } from './helpers.mjs'
25
25
import * as semver from 'semver'
26
26
27
- /**
28
- * @typedef {Object } NodeInfo
29
- * @property {string } nodeName
30
- * @property {string } accountId
31
- */
32
-
33
27
const consensusSidecars = [
34
28
'recordStreamUploader' , 'eventStreamUploader' , 'backupUploader' , 'accountBalanceUploader' , 'otelCollector' ]
35
29
@@ -158,18 +152,11 @@ export class ProfileManager {
158
152
159
153
const accountMap = getNodeAccountMap ( nodeIds )
160
154
161
- /** @type {Map<string, NodeInfo> } **/
162
- const nodeMap = new Map ( )
163
-
164
155
// set consensus pod level resources
165
156
for ( let nodeIndex = 0 ; nodeIndex < nodeIds . length ; nodeIndex ++ ) {
166
- const fullAccountId = `${ realm } .${ shard } .${ accountId ++ } `
167
-
168
157
this . _setValue ( `hedera.nodes.${ nodeIndex } .name` , nodeIds [ nodeIndex ] , yamlRoot )
169
- this . _setValue ( `hedera.nodes.${ nodeIndex } .accountId` , fullAccountId , yamlRoot )
158
+ this . _setValue ( `hedera.nodes.${ nodeIndex } .accountId` , accountMap . get ( nodeIds [ nodeIndex ] ) , yamlRoot )
170
159
this . _setChartItems ( `hedera.nodes.${ nodeIndex } ` , profile . consensus , yamlRoot )
171
-
172
- nodeMap . set ( nodeIds [ nodeIndex ] , { nodeName : nodeIds [ nodeIndex ] , accountId : fullAccountId } )
173
160
}
174
161
175
162
const stagingDir = Templates . renderStagingDir ( this . configManager , flags )
@@ -385,16 +372,16 @@ export class ProfileManager {
385
372
/**
386
373
* Prepares config.txt file for the node
387
374
* @param {string } namespace namespace where the network is deployed
388
- * @param {Map<string, NodeInfo > } nodeMap Map of NodeInfo objects
375
+ * @param {Map<string, string > } nodeAccountMap the map of node IDs to account IDs
389
376
* @param {string } destPath path to the destination directory to write the config.txt file
390
377
* @param {string } releaseTag release tag e.g. v0.42.0
391
378
* @param {string } appName the app name (default: HederaNode.jar)
392
379
* @param {string } chainId chain ID (298 for local network)
393
380
* @param {string } template path to the config.template file
394
381
* @returns {string } the config.txt file path
395
382
*/
396
- prepareConfigTxt ( namespace , nodeMap , destPath , releaseTag , appName = constants . HEDERA_APP_NAME , chainId = constants . HEDERA_CHAIN_ID , template = `${ constants . RESOURCES_DIR } /templates/config.template` ) {
397
- if ( ! nodeMap || nodeMap . length === 0 ) throw new MissingArgumentError ( 'map of NodeInfo objects is required' )
383
+ prepareConfigTxt ( namespace , nodeAccountMap , destPath , releaseTag , appName = constants . HEDERA_APP_NAME , chainId = constants . HEDERA_CHAIN_ID , template = `${ constants . RESOURCES_DIR } /templates/config.template` ) {
384
+ if ( ! nodeAccountMap || nodeAccountMap . length === 0 ) throw new MissingArgumentError ( 'nodeAccountMap the map of node IDs to account IDs is required' )
398
385
if ( ! template ) throw new MissingArgumentError ( 'config templatePath is required' )
399
386
if ( ! releaseTag ) throw new MissingArgumentError ( 'release tag is required' )
400
387
@@ -415,16 +402,15 @@ export class ProfileManager {
415
402
configLines . push ( `app, ${ appName } ` )
416
403
417
404
let nodeSeq = 0
418
- for ( const nodeInfo of nodeMap . values ( ) ) {
419
- const nodeName = nodeInfo . nodeId
420
- const nodeNickName = nodeInfo . nodeId
405
+ for ( const nodeID of nodeAccountMap . keys ( ) ) {
406
+ const nodeName = nodeID
421
407
422
408
const internalIP = Templates . renderFullyQualifiedNetworkPodName ( namespace , nodeName )
423
409
const externalIP = Templates . renderFullyQualifiedNetworkSvcName ( namespace , nodeName )
424
410
425
- const account = nodeInfo . accountId
411
+ const account = nodeAccountMap . get ( nodeID )
426
412
if ( releaseVersion . minor >= 40 ) {
427
- configLines . push ( `address, ${ nodeSeq } , ${ nodeNickName } , ${ nodeName } , ${ nodeStakeAmount } , ${ internalIP } , ${ internalPort } , ${ externalIP } , ${ externalPort } , ${ account } ` )
413
+ configLines . push ( `address, ${ nodeSeq } , ${ nodeName } , ${ nodeName } , ${ nodeStakeAmount } , ${ internalIP } , ${ internalPort } , ${ externalIP } , ${ externalPort } , ${ account } ` )
428
414
} else {
429
415
configLines . push ( `address, ${ nodeSeq } , ${ nodeName } , ${ nodeStakeAmount } , ${ internalIP } , ${ internalPort } , ${ externalIP } , ${ externalPort } , ${ account } ` )
430
416
}
0 commit comments