From 14ddbd9574fef427dee15de960c5b2c7691cdea7 Mon Sep 17 00:00:00 2001 From: Lutty Date: Mon, 5 Jul 2021 23:54:08 +0800 Subject: [PATCH] remove IsBackup to GetNodeMetadata API --- hmy/hmy.go | 1 + rpc/blockchain.go | 4 ---- rpc/common/types.go | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hmy/hmy.go b/hmy/hmy.go index ea80d8db8..7501882b5 100644 --- a/hmy/hmy.go +++ b/hmy/hmy.go @@ -206,6 +206,7 @@ func (hmy *Harmony) GetNodeMetadata() commonRPC.NodeMetadata { Role: cfg.Role().String(), DNSZone: cfg.DNSZone, Archival: cfg.GetArchival(), + IsBackup: hmy.NodeAPI.IsBackup(), NodeBootTime: hmy.NodeAPI.GetNodeBootTime(), PeerID: nodeconfig.GetPeerID(), Consensus: consensusInternal, diff --git a/rpc/blockchain.go b/rpc/blockchain.go index b88579c8b..52ed9d6e5 100644 --- a/rpc/blockchain.go +++ b/rpc/blockchain.go @@ -838,10 +838,6 @@ func isBlockGreaterThanLatest(hmy *hmy.Harmony, blockNum rpc.BlockNumber) bool { return uint64(blockNum) > hmy.CurrentBlock().NumberU64() } -func (s *PublicBlockchainService) GetCurrentNodeBackupState(ctx context.Context) (bool, error) { - return s.hmy.NodeAPI.IsBackup(), nil -} - func (s *PublicBlockchainService) SetNodeToBackupMode(ctx context.Context, isBackup bool) (bool, error) { return s.hmy.NodeAPI.SetNodeBackupMode(isBackup), nil } diff --git a/rpc/common/types.go b/rpc/common/types.go index 6b1e3ce9f..fa2aea4ab 100644 --- a/rpc/common/types.go +++ b/rpc/common/types.go @@ -64,6 +64,7 @@ type NodeMetadata struct { Role string `json:"role"` DNSZone string `json:"dns-zone"` Archival bool `json:"is-archival"` + IsBackup bool `json:"is-backup"` NodeBootTime int64 `json:"node-unix-start-time"` PeerID peer.ID `json:"peerid"` Consensus ConsensusInternal `json:"consensus"`