Skip to content

Commit

Permalink
feat(dpos2.0):check EOF error of FilterLoad.Deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
RainFallsSilent committed Mar 29, 2023
1 parent d6773c1 commit 582f585
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions p2p/msg/filterload.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,15 @@ func (msg *FilterLoad) Deserialize(r io.Reader) error {
return err
}

// deserialize TxTypes ignore the result
count, _ := common.ReadVarUint(r, 0)
msg.TxTypes = make([]common2.TxType, 0, count)
msg.TxTypes = make([]common2.TxType, 0)
count, err := common.ReadVarUint(r, 0)
if err != nil {
if err == io.EOF {
return nil
}
return err
}

for i := uint64(0); i < count; i++ {
var txType byte
err = common.ReadElement(r, &txType)
Expand Down

0 comments on commit 582f585

Please sign in to comment.