From adcc17baf79b3b876b5a8e3a4a107bfe391e0339 Mon Sep 17 00:00:00 2001 From: Alexey Sharp Date: Fri, 16 Jul 2021 17:00:51 +0100 Subject: [PATCH] More encoding --- txpool/packets.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/txpool/packets.go b/txpool/packets.go index a3c5b4016..de13c59d7 100644 --- a/txpool/packets.go +++ b/txpool/packets.go @@ -113,3 +113,17 @@ func EncodeHashes(hashes []byte, count int, encodeBuf []byte) ([]byte, error) { } return encoding, nil } + +// EncodeGetPooledTransactions66 produces encoding of GetPooledTransactions66 packet +func EncodeGetPooledTransactions66(hashes []byte, count int, requestId uint64, encodeBuf []byte) ([]byte, error) { + var prefixLen int + requestIdLen := (bits.Len64(requestId) + 7) / 8 + dataLen := count * 33 + var beLen int + if dataLen < 56 { + prefixLen = 1 + } else { + beLen = (bits.Len64(uint64(dataLen)) + 7) / 8 + prefixLen = 1 + beLen + } +}