Skip to content

Commit 28d7403

Browse files
authored
Merge pull request #458 from blinklabs-io/fix/txsubmission-encoding
fix: CBOR encoding for TxSubmission MsgRequestTxs
2 parents 84a7e14 + 37ebcb2 commit 28d7403

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

protocol/txsubmission/messages.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ type MsgRequestTxs struct {
113113
TxIds []TxId
114114
}
115115

116+
func (m *MsgRequestTxs) MarshalCBOR() ([]byte, error) {
117+
items := []any{}
118+
for _, txId := range m.TxIds {
119+
items = append(items, txId)
120+
}
121+
tmp := []any{
122+
MessageTypeRequestTxs,
123+
cbor.IndefLengthList{
124+
Items: items,
125+
},
126+
}
127+
return cbor.Encode(tmp)
128+
}
129+
116130
func NewMsgRequestTxs(txIds []TxId) *MsgRequestTxs {
117131
m := &MsgRequestTxs{
118132
MessageBase: protocol.MessageBase{

0 commit comments

Comments
 (0)