Merge pull request #320 from meshplus/fix/subscribe-nil-pier
fix(api): fix panic when subscribe pid is nil
This commit is contained in:
commit
c75adafb2b
|
@ -26,8 +26,14 @@ func (cbs *ChainBrokerService) Subscribe(req *pb.SubscriptionRequest, server pb.
|
|||
case pb.SubscriptionRequest_BLOCK_HEADER.String():
|
||||
return cbs.handleBlockHeaderSubscription(server)
|
||||
case pb.SubscriptionRequest_INTERCHAIN_TX_WRAPPER.String():
|
||||
if !types.IsValidAddressByte(req.Extra) {
|
||||
return fmt.Errorf("invalid pier address to subscribe")
|
||||
}
|
||||
return cbs.handleInterchainTxWrapperSubscription(server, types.NewAddressByStr(string(req.Extra)).String(), false)
|
||||
case pb.SubscriptionRequest_UNION_INTERCHAIN_TX_WRAPPER.String():
|
||||
if !types.IsValidAddressByte(req.Extra) {
|
||||
return fmt.Errorf("invalid pier address to subscribe")
|
||||
}
|
||||
return cbs.handleInterchainTxWrapperSubscription(server, types.NewAddressByStr(string(req.Extra)).String(), true)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue