mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-02 22:27:19 +00:00
mempool implements wrap / unwrap
This commit is contained in:
@@ -3,20 +3,17 @@ package mempool
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
)
|
||||
|
||||
var _ p2p.Wrapper = &Message_Txs{}
|
||||
|
||||
// Wrap implements the p2p Wrapper interface and wraps a mempool message.
|
||||
func (m *Message) Wrap(pb proto.Message) error {
|
||||
switch msg := pb.(type) {
|
||||
case *Txs:
|
||||
m.Sum = &Message_Txs{Txs: msg}
|
||||
|
||||
default:
|
||||
return fmt.Errorf("unknown message: %T", msg)
|
||||
}
|
||||
|
||||
return nil
|
||||
func (m *Message_Txs) Wrap() (proto.Message, error) {
|
||||
return &Message{
|
||||
Sum: m,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Unwrap implements the p2p Wrapper interface and unwraps a wrapped mempool
|
||||
|
||||
Reference in New Issue
Block a user