func (rb *T) AddRequest(msg messages.Request) (<-chan messages.Reply, bool) {
	rb.lock.Lock()
	defer rb.lock.Unlock()
	for rb.request != nil {
		req := rb.request
		rb.lock.Unlock()
		<-req.removed
		rb.lock.Lock()
	}
	if msg.Sequence() <= rb.lastSeq {
		return nil, false
	}
	rb.lastSeq = msg.Sequence()
	rb.request = newRequest(msg)
	for _, ch := range rb.newAdded {
		select {
		case ch <- struct{}{}:
		default:
		}
	}
	replyChannel := make(chan messages.Reply)
	go rb.request.supplyReplies(replyChannel)
	return replyChannel, true
}
AddRequest adds a new Request message to the buffer. Each
subsequent invocation should supply a message with increasing
non-zero sequence ID. It will block if there's no capacity
available for the new message. The corresponding Reply messages are
to be received from the returned channel as they are added with
AddReply. The returned channel is closed when RemoveRequest is
invoked for the Request message. The returned boolean value
indicates if the message was accepted.
package requestbuffer
import (
	"sync"
	"github.com/hyperledger-labs/minbft/messages"
)
type T struct {
	lock sync.RWMutex
	lastSeq uint64
	request *request
	newAdded []chan<- struct{}
}
func New() *T {
	return &T{}
}