From 074240e7ee54e082f938c10e4f0dee3d9d182a6e Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Mon, 16 Sep 2019 17:48:51 -0700 Subject: [PATCH] add getShardID api --- internal/hmyapi/blockchain.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/hmyapi/blockchain.go b/internal/hmyapi/blockchain.go index 6a0a23704..1cfec4b65 100644 --- a/internal/hmyapi/blockchain.go +++ b/internal/hmyapi/blockchain.go @@ -73,6 +73,11 @@ func (s *PublicBlockChainAPI) GetShardingStructure(ctx context.Context) ([]map[s return core.ShardingSchedule.GetShardingStructure(int(numShard), int(s.b.GetShardID())), nil } +// GetShardID returns shard ID of the requested node. +func (s *PublicBlockChainAPI) GetShardID(ctx context.Context) (int, error) { + return int(s.b.GetShardID()), nil +} + // GetCode returns the code stored at the given address in the state for the given block number. func (s *PublicBlockChainAPI) GetCode(ctx context.Context, addr string, blockNr rpc.BlockNumber) (hexutil.Bytes, error) { address := internal_common.ParseAddr(addr)