protofsm: update StateMachine to meet new msgmux.Endpoint interface

This commit is contained in:
Olaoluwa Osuntokun committed 2025-03-18 11:44:20 -05:00
1 parent bf3007a2ce
commit ed8a672bd3
2 files changed
+11 -5

No files matched your search

+3 -2
View File
@@ -14,6 +14,7 @@ import (
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/lnutils"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/msgmux"
)
const (
@@ -250,7 +251,7 @@ func (s *StateMachine[Event, Env]) SendEvent(ctx context.Context, event Event) {
// CanHandle returns true if the target message can be routed to the state
// machine.
func (s *StateMachine[Event, Env]) CanHandle(msg lnwire.Message) bool {
func (s *StateMachine[Event, Env]) CanHandle(msg msgmux.PeerMsg) bool {
cfgMapper := s.cfg.MsgMapper
return fn.MapOptionZ(cfgMapper, func(mapper MsgMapper[Event]) bool {
return mapper.MapMsg(msg).IsSome()
@@ -267,7 +268,7 @@ func (s *StateMachine[Event, Env]) Name() string {
// returned indicating that the message was processed. Otherwise, false is
// returned.
func (s *StateMachine[Event, Env]) SendMessage(ctx context.Context,
msg lnwire.Message) bool {
msg msgmux.PeerMsg) bool {
// If we have no message mapper, then return false as we can't process
// this message.