[rosetta] use shard config instead of default config

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3471/head
Leo Chen 4 years ago
parent 74971b63b9
commit 91250e1ec6
  1. 2
      rosetta/rosetta.go
  2. 4
      rosetta/services/network.go

@ -36,7 +36,7 @@ func StartServers(hmy *hmy.Harmony, config nodeconfig.RosettaServerConfig) error
}
serverAsserter, err := asserter.NewServer(
append(common.PlainOperationTypes, common.StakingOperationTypes...),
nodeconfig.GetDefaultConfig().Role() == nodeconfig.ExplorerNode,
nodeconfig.GetShardConfig(hmy.ShardID).Role() == nodeconfig.ExplorerNode,
[]*types.NetworkIdentifier{network},
)
if err != nil {

@ -98,7 +98,7 @@ func (s *NetworkAPI) NetworkStatus(
// Only applicable to non-archival nodes
var oldestBlockIdentifier *types.BlockIdentifier
if !nodeconfig.GetDefaultConfig().GetArchival() {
if !nodeconfig.GetShardConfig(s.hmy.ShardID).GetArchival() {
maxGarbCollectedBlockNum := s.hmy.BlockChain.GetMaxGarbageCollectedBlockNumber()
if maxGarbCollectedBlockNum == -1 || maxGarbCollectedBlockNum >= currentHeader.Number().Int64() {
oldestBlockIdentifier = currentBlockIdentifier
@ -143,7 +143,7 @@ func (s *NetworkAPI) NetworkOptions(
// Fetch allows based on current network option
var allow *types.Allow
isArchival := nodeconfig.GetDefaultConfig().GetArchival()
isArchival := nodeconfig.GetShardConfig(s.hmy.ShardID).GetArchival()
if s.hmy.ShardID == shard.BeaconChainShardID {
allow = getBeaconAllow(isArchival)
} else {

Loading…
Cancel
Save