func updateNumOfTxInputs(msgSplit [][]byte, numOfInputs int) int {
	if len(msgSplit) > numOfInputs {
		numOfInputs = len(msgSplit)
	}
	return numOfInputs
}
Update num of transaction inputs from latest msg
package attestation
import (
	"fmt"
	confpkg "mainstay/config"
	"mainstay/crypto"
	"mainstay/log"
	"mainstay/messengers"
	zmq "github.com/pebbe/zmq4"
)
const (
	DefaultMainPublisherPort = 5000  
	TopicNewTx         = "T"
	TopicConfirmedHash = "C"
	TopicSigs          = "S"
)
type AttestSignerZmq struct {
	publisher *messengers.PublisherZmq
	subscribers []*messengers.SubscriberZmq
	config confpkg.SignerConfig
}
var poller *zmq.Poller
func NewAttestSignerZmq(config confpkg.SignerConfig) *AttestSignerZmq {
	publisherAddr := fmt.Sprintf("*:%d", DefaultMainPublisherPort)
	if config.Publisher != "" {
		publisherAddr = config.Publisher
	}
	poller = zmq.NewPoller()
	publisher := messengers.NewPublisherZmq(publisherAddr, poller)
	var subscribers []*messengers.SubscriberZmq
	subtopics := []string{TopicSigs}
	for _, nodeaddr := range config.Signers {
		subscribers = append(subscribers, messengers.NewSubscriberZmq(nodeaddr, subtopics, poller))
	}
	return &AttestSignerZmq{publisher, subscribers, config}
}
func (z *AttestSignerZmq) ReSubscribe() {
	for _, sub := range z.subscribers {
		sub.Close(poller)
	}
	z.subscribers = nil  
	var subscribers []*messengers.SubscriberZmq
	subtopics := []string{TopicSigs}
	for _, nodeaddr := range z.config.Signers {
		subscribers = append(subscribers, messengers.NewSubscriberZmq(nodeaddr, subtopics, poller))
	}
	z.subscribers = subscribers
}
func (z AttestSignerZmq) SendConfirmedHash(hash []byte) {
	z.publisher.SendMessage(hash, TopicConfirmedHash)
}
func SerializeBytes(data [][]byte) []byte {
	if len(data) == 0 {
		return []byte{}
	}
	var serializedBytes []byte
	for _, dataX := range data {
		serializedBytes = append(serializedBytes, byte(len(dataX)))
		serializedBytes = append(serializedBytes, dataX...)
	}
	return serializedBytes
}
func UnserializeBytes(data []byte) [][]byte {
	if len(data) == 0 {
		return [][]byte{}
	}
	var dataList [][]byte
	it := 0
	for it < len(data) {
		txSize := data[it]
		if (int(txSize) + 1 + it) > len(data) {
			break
		}
		dataX := append([]byte{}, data[it+1:it+1+int(txSize)]...)
		dataList = append(dataList, dataX)
		it += 1 + int(txSize)
	}
	return dataList
}
func (z AttestSignerZmq) SendTxPreImages(txs [][]byte) {
	z.publisher.SendMessage(SerializeBytes(txs), TopicNewTx)
}
func getSigsFromMsgs(msgs [][][]byte, numOfInputs int) [][]crypto.Sig {
	if numOfInputs == 0 {
		return [][]crypto.Sig{}
	}
	sigs := make([][]crypto.Sig, numOfInputs)
	for i := 0; i < numOfInputs; i++ {
		for _, msgSplit := range msgs {
			if len(msgSplit) > i {
				sigs[i] = append(sigs[i], crypto.Sig(msgSplit[i]))
			}
		}
	}
	return sigs
}