Skip to content

Commit

Permalink
handle nil mix tx better in cm message
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Aug 8, 2023
1 parent 48b857a commit be7d77b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wire/msgmixcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func (msg *MsgMixCM) writeMessageNoSignature(op string, w io.Writer, pver uint32
return err
}

if msg.Mix == nil {
msg := fmt.Sprintf("nil mix transaction")
return messageError(op, ErrInvalidMsg, msg)
}
err = msg.Mix.BtcEncode(w, pver)
if err != nil {
return err
Expand Down Expand Up @@ -201,6 +205,10 @@ func (msg *MsgMixCM) GetRun() uint32 {
func NewMsgMixCM(identity [33]byte, sid [32]byte, expiry int64, run uint32,
mix *MsgTx, seenDCs []chainhash.Hash) *MsgMixCM {

if mix == nil {
mix = NewMsgTx()
}

return &MsgMixCM{
Identity: identity,
SessionID: sid,
Expand Down

0 comments on commit be7d77b

Please sign in to comment.