Skip to content

Commit

Permalink
rpc: Fix chain id required 💊
Browse files Browse the repository at this point in the history
  • Loading branch information
Fondago authored and const-subject committed Sep 17, 2018
1 parent 67a0254 commit d1262f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rpc/method_chain.go
Expand Up @@ -37,8 +37,6 @@ func init() {
Register("chain.get", func() Executer { return new(GetChainRequest) })
}



func (preq *LoadChainRequest) execute(r *Request) *Response {
ch, e := cf.ChainHelper().GetChainById([]byte(preq.Chain))

Expand All @@ -64,6 +62,7 @@ func (preq *LoadChainRequest) execute(r *Request) *Response {

result = append(result, tx)
}

resp := &LoadChainResponse{
Chain: preq.Chain,
Start: preq.Start,
Expand All @@ -75,8 +74,11 @@ func (preq *LoadChainRequest) execute(r *Request) *Response {
}

func (preq *GetChainRequest) execute(r *Request) *Response {
ch, e := cf.ChainHelper().GetChainById([]byte(preq.Id))
if len(preq.Id) == 0 {
return response(nil, err(0, "Write correct chain id"))
}

ch, e := cf.ChainHelper().GetChainById([]byte(preq.Id))
if e != nil {
return response(nil, err(0, e.Error()))
}
Expand Down

0 comments on commit d1262f0

Please sign in to comment.