Merge pull request #2595 from janet-harmony/seperate-bls-keys

[rpc] Return public BLSKeys as a list from getNodeMetadata
pull/2600/head
Leo Chen 5 years ago committed by GitHub
commit 7f1dd41fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      internal/hmyapi/apiv1/harmony.go
  2. 9
      internal/hmyapi/apiv2/harmony.go

@ -47,7 +47,7 @@ func (s *PublicHarmonyAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) {
// NodeMetadata captures select metadata of the RPC answering node
type NodeMetadata struct {
BLSPublicKey string `json:"blskey"`
BLSPublicKey []string `json:"blskey"`
Version string `json:"version"`
NetworkType string `json:"network"`
ChainConfig params.ChainConfig `json:"chain-config"`
@ -72,8 +72,13 @@ func (s *PublicHarmonyAPI) GetNodeMetadata() NodeMetadata {
blockEpoch = &b
}
var blsKeys []string
for _, key := range cfg.ConsensusPubKey.PublicKey {
blsKeys = append(blsKeys, key.SerializeToHexStr())
}
return NodeMetadata{
cfg.ConsensusPubKey.SerializeToHexStr(),
blsKeys,
nodeconfig.GetVersion(),
string(cfg.GetNetworkType()),
*s.b.ChainConfig(),

@ -46,7 +46,7 @@ func (s *PublicHarmonyAPI) GasPrice(ctx context.Context) (*big.Int, error) {
// NodeMetadata captures select metadata of the RPC answering node
type NodeMetadata struct {
BLSPublicKey string `json:"blskey"`
BLSPublicKey []string `json:"blskey"`
Version string `json:"version"`
NetworkType string `json:"network"`
ChainConfig params.ChainConfig `json:"chain-config"`
@ -71,8 +71,13 @@ func (s *PublicHarmonyAPI) GetNodeMetadata() NodeMetadata {
blockEpoch = &b
}
var blsKeys []string
for _, key := range cfg.ConsensusPubKey.PublicKey {
blsKeys = append(blsKeys, key.SerializeToHexStr())
}
return NodeMetadata{
cfg.ConsensusPubKey.SerializeToHexStr(),
blsKeys,
nodeconfig.GetVersion(),
string(cfg.GetNetworkType()),
*s.b.ChainConfig(),

Loading…
Cancel
Save