2024-01-25 17:22:00 -08:00
|
|
|
package protofsm
|
|
|
|
|
|
|
|
import (
|
2024-12-03 15:51:05 -07:00
|
|
|
"github.com/lightningnetwork/lnd/fn/v2"
|
2024-01-25 17:22:00 -08:00
|
|
|
"github.com/lightningnetwork/lnd/lnwire"
|
|
|
|
)
|
|
|
|
|
|
|
|
// MsgMapper is used to map incoming wire messages into a FSM event. This is
|
|
|
|
// useful to decouple the translation of an outside or wire message into an
|
|
|
|
// event type that can be understood by the FSM.
|
|
|
|
type MsgMapper[Event any] interface {
|
|
|
|
// MapMsg maps a wire message into a FSM event. If the message is not
|
|
|
|
// mappable, then an None is returned.
|
|
|
|
MapMsg(msg lnwire.Message) fn.Option[Event]
|
|
|
|
}
|