Skip to content

Commit 49b7cb5

Browse files
committed
pss: fixed type conversion error
1 parent 99d4b48 commit 49b7cb5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pss/pss.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -705,13 +705,11 @@ func sendMsg(p *Pss, sp *network.Peer, msg *PssMsg) bool {
705705
//// successfully forwarded to at least one peer.
706706
func (p *Pss) forward(msg interface{}) error {
707707
var pssMsg *PssMsg
708-
switch msg.(type) {
709-
case PssMsg:
710-
pssMsg = msg.(*PssMsg)
711-
default:
708+
pssMsg, ok := msg.(*PssMsg)
709+
if !ok {
712710
return errors.New("cannot forward a non pssMsg pssMsg")
713-
714711
}
712+
715713
metrics.GetOrRegisterCounter("pss.forward", nil).Inc(1)
716714
sent := 0 // number of successful sends
717715
to := make([]byte, addressLength)

0 commit comments

Comments
 (0)