From be7d77bd5d82cdd52314b2aedaa0530260b7a709 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 8 Aug 2023 21:11:31 +0000 Subject: [PATCH] handle nil mix tx better in cm message --- wire/msgmixcm.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wire/msgmixcm.go b/wire/msgmixcm.go index 92465d7939..92a8910f83 100644 --- a/wire/msgmixcm.go +++ b/wire/msgmixcm.go @@ -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 @@ -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,