looprpc: map custom channel reason

Static autoloop testing surfaced a SuggestSwaps failure when the
planner disqualified a custom asset channel.

Add the missing AutoReason enum value and handle ReasonCustomChannelData.
This commit is contained in:
Boris Nagaev 2026-04-13 01:17:30 -05:00
parent 58ebb042ff
commit 8ea9adbd35
No known key found for this signature in database
6 changed files with 33 additions and 4 deletions

View file

@ -2442,6 +2442,9 @@ func rpcAutoloopReason(reason liquidity.Reason) (looprpc.AutoReason, error) {
return looprpc.AutoReason_AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE,
nil
case liquidity.ReasonCustomChannelData:
return looprpc.AutoReason_AUTO_REASON_CUSTOM_CHANNEL_DATA, nil
default:
return 0, fmt.Errorf("unknown autoloop reason: %v", reason)
}

View file

@ -295,6 +295,16 @@ func TestRPCAutoloopReasonStaticLoopInNoCandidate(t *testing.T) {
)
}
// TestRPCAutoloopReasonCustomChannelData verifies that custom-channel
// disqualifications are exposed over rpc instead of failing the whole dry run.
func TestRPCAutoloopReasonCustomChannelData(t *testing.T) {
reason, err := rpcAutoloopReason(liquidity.ReasonCustomChannelData)
require.NoError(t, err)
require.Equal(
t, looprpc.AutoReason_AUTO_REASON_CUSTOM_CHANNEL_DATA, reason,
)
}
// TestSwapClientServerStopDaemon ensures that calling StopDaemon triggers the
// daemon shutdown.
func TestSwapClientServerStopDaemon(t *testing.T) {