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

+8 -3
View File
@@ -13,6 +13,7 @@ import (
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/msgmux"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
@@ -429,8 +430,12 @@ func TestStateMachineMsgMapper(t *testing.T) {
// The only thing we know how to map is the error message, which'll
// terminate the state machine.
wireError := &lnwire.Error{}
initMsg := &lnwire.Init{}
wireError := msgmux.PeerMsg{
Message: &lnwire.Error{},
}
initMsg := msgmux.PeerMsg{
Message: &lnwire.Init{},
}
dummyMapper.On("MapMsg", wireError).Return(
fn.Some(dummyEvents(&goToFin{})),
)
@@ -456,7 +461,7 @@ func TestStateMachineMsgMapper(t *testing.T) {
// First, we'll verify that the CanHandle method works as expected.
require.True(t, stateMachine.CanHandle(wireError))
require.False(t, stateMachine.CanHandle(&lnwire.Init{}))
require.False(t, stateMachine.CanHandle(initMsg))
// Next, we'll attempt to send the wire message into the state machine.
// We should transition to the final state.