diff --git a/internal/configs/node/config.go b/internal/configs/node/config.go index 3a06196d6..962507872 100644 --- a/internal/configs/node/config.go +++ b/internal/configs/node/config.go @@ -69,6 +69,8 @@ type ConfigType struct { isBeacon bool // whether this node is beacon node doing consensus or not ShardID uint32 // ShardID of this node role Role // Role of the node + Port string + IP string StringRole string Host p2p.Host diff --git a/internal/utils/utils.go b/internal/utils/utils.go index a81fc2bb0..19a36b976 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -15,8 +15,8 @@ import ( "sync" "github.com/ethereum/go-ethereum/common" - "github.com/harmony-one/bls/ffi/go/bls" + "github.com/harmony-one/harmony/internal/utils" p2p_crypto "github.com/libp2p/go-libp2p-crypto" ) @@ -233,3 +233,12 @@ func GetBlsAddress(key *bls.PublicKey) common.Address { addr.SetBytes(addrBytes[:]) return addr } + +// GetPortFromDiff returns the port from base and the diff. +func GetPortFromDiff(port string, diff int) string { + if portNum, err := strconv.Atoi(port); err == nil { + return fmt.Sprintf("%d", portNum-diff) + } + utils.GetLogInstance().Error("error on parsing port.") + return "" +}