File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -585,14 +585,17 @@ export class AccountManager {
585
585
// ensure serviceEndpoint.ipAddressV4 value for all nodes in the addressBook is a 4 bytes array instead of string
586
586
// See: https://github.com/hashgraph/hedera-protobufs/blob/main/services/basic_types.proto#L1309
587
587
const addressBook = HashgraphProto . proto . NodeAddressBook . decode ( addressBookBytes )
588
+ const hasAlphaRegEx = / [ a - z A - Z ] + /
588
589
let modified = false
589
590
for ( const nodeAddress of addressBook . nodeAddress ) {
590
- // overwrite ipAddressV4 as 4 bytes array if required
591
- if ( nodeAddress . serviceEndpoint [ 0 ] . ipAddressV4 . byteLength !== 4 ) {
592
- const ipAddress = nodeAddress . serviceEndpoint [ 0 ] . ipAddressV4 . toString ( )
593
- const parts = ipAddress . split ( '.' )
591
+ const address = nodeAddress . serviceEndpoint [ 0 ] . ipAddressV4 . toString ( )
592
+
593
+ // overwrite ipAddressV4 as 4 bytes array if required, unless there is alpha, which means it is a domain name
594
+ if ( nodeAddress . serviceEndpoint [ 0 ] . ipAddressV4 . byteLength !== 4 && ! hasAlphaRegEx . test ( address ) ) {
595
+ const parts = address . split ( '.' )
596
+
594
597
if ( parts . length !== 4 ) {
595
- throw new FullstackTestingError ( `expected node IP address to have 4 parts, found ${ parts . length } : ${ ipAddress } ` )
598
+ throw new FullstackTestingError ( `expected node IP address to have 4 parts, found ${ parts . length } : ${ address } ` )
596
599
}
597
600
598
601
nodeAddress . serviceEndpoint [ 0 ] . ipAddressV4 = Uint8Array . from ( parts )
You can’t perform that action at this time.
0 commit comments