diff --git a/liquidity/reasons.go b/liquidity/reasons.go index 5f7cf618..a186e6f8 100644 --- a/liquidity/reasons.go +++ b/liquidity/reasons.go @@ -128,6 +128,9 @@ func (r Reason) String() string { case ReasonLoopInUnreachable: return "loop in unreachable" + case ReasonCustomChannelData: + return "custom channel data" + case ReasonStaticLoopInNoCandidate: return "no static loop-in candidate" diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index 04353823..f26f1d91 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -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) } diff --git a/loopd/swapclient_server_test.go b/loopd/swapclient_server_test.go index f509b7ae..d7a30f6d 100644 --- a/loopd/swapclient_server_test.go +++ b/loopd/swapclient_server_test.go @@ -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) { diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index 27b8b0fd..d0cf44f1 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -427,6 +427,9 @@ const ( // No static loop-in candidate indicates that static loop-in autoloop was // selected, but no full-deposit static candidate fit the rule. AutoReason_AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE AutoReason = 14 + // Custom channel data indicates that the target channel carries custom + // channel data and is excluded from the standard autoloop planner. + AutoReason_AUTO_REASON_CUSTOM_CHANNEL_DATA AutoReason = 15 ) // Enum value maps for AutoReason. @@ -447,6 +450,7 @@ var ( 12: "AUTO_REASON_BUDGET_INSUFFICIENT", 13: "AUTO_REASON_FEE_INSUFFICIENT", 14: "AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE", + 15: "AUTO_REASON_CUSTOM_CHANNEL_DATA", } AutoReason_value = map[string]int32{ "AUTO_REASON_UNKNOWN": 0, @@ -464,6 +468,7 @@ var ( "AUTO_REASON_BUDGET_INSUFFICIENT": 12, "AUTO_REASON_FEE_INSUFFICIENT": 13, "AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE": 14, + "AUTO_REASON_CUSTOM_CHANNEL_DATA": 15, } ) @@ -7059,7 +7064,7 @@ const file_client_proto_rawDesc = "" + "\x1dLOOP_IN_SOURCE_STATIC_ADDRESS\x10\x01*/\n" + "\x11LiquidityRuleType\x12\v\n" + "\aUNKNOWN\x10\x00\x12\r\n" + - "\tTHRESHOLD\x10\x01*\xd3\x03\n" + + "\tTHRESHOLD\x10\x01*\xf8\x03\n" + "\n" + "AutoReason\x12\x17\n" + "\x13AUTO_REASON_UNKNOWN\x10\x00\x12\"\n" + @@ -7077,7 +7082,8 @@ const file_client_proto_rawDesc = "" + "\x18AUTO_REASON_LIQUIDITY_OK\x10\v\x12#\n" + "\x1fAUTO_REASON_BUDGET_INSUFFICIENT\x10\f\x12 \n" + "\x1cAUTO_REASON_FEE_INSUFFICIENT\x10\r\x12+\n" + - "'AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE\x10\x0e*\x88\x02\n" + + "'AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE\x10\x0e\x12#\n" + + "\x1fAUTO_REASON_CUSTOM_CHANNEL_DATA\x10\x0f*\x88\x02\n" + "\fDepositState\x12\x11\n" + "\rUNKNOWN_STATE\x10\x00\x12\r\n" + "\tDEPOSITED\x10\x01\x12\x0f\n" + diff --git a/looprpc/client.proto b/looprpc/client.proto index 7ab3444c..52b9fcbb 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -1549,6 +1549,12 @@ enum AutoReason { selected, but no full-deposit static candidate fit the rule. */ AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE = 14; + + /* + Custom channel data indicates that the target channel carries custom + channel data and is excluded from the standard autoloop planner. + */ + AUTO_REASON_CUSTOM_CHANNEL_DATA = 15; } message Disqualified { diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index 9a3a4bca..e336cb7d 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -1544,10 +1544,11 @@ "AUTO_REASON_LIQUIDITY_OK", "AUTO_REASON_BUDGET_INSUFFICIENT", "AUTO_REASON_FEE_INSUFFICIENT", - "AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE" + "AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE", + "AUTO_REASON_CUSTOM_CHANNEL_DATA" ], "default": "AUTO_REASON_UNKNOWN", - "description": " - AUTO_REASON_BUDGET_NOT_STARTED: Budget not started indicates that we do not recommend any swaps because\nthe start time for our budget has not arrived yet.\n - AUTO_REASON_SWEEP_FEES: Sweep fees indicates that the estimated fees to sweep swaps are too high\nright now.\n - AUTO_REASON_BUDGET_ELAPSED: Budget elapsed indicates that the autoloop budget for the period has been\nelapsed.\n - AUTO_REASON_IN_FLIGHT: In flight indicates that the limit on in-flight automatically dispatched\nswaps has already been reached.\n - AUTO_REASON_SWAP_FEE: Swap fee indicates that the server fee for a specific swap is too high.\n - AUTO_REASON_MINER_FEE: Miner fee indicates that the miner fee for a specific swap is to high.\n - AUTO_REASON_PREPAY: Prepay indicates that the prepay fee for a specific swap is too high.\n - AUTO_REASON_FAILURE_BACKOFF: Failure backoff indicates that a swap has recently failed for this target,\nand the backoff period has not yet passed.\n - AUTO_REASON_LOOP_OUT: Loop out indicates that a loop out swap is currently utilizing the channel,\nso it is not eligible.\n - AUTO_REASON_LOOP_IN: Loop In indicates that a loop in swap is currently in flight for the peer,\nso it is not eligible.\n - AUTO_REASON_LIQUIDITY_OK: Liquidity ok indicates that a target meets the liquidity balance expressed\nin its rule, so no swap is needed.\n - AUTO_REASON_BUDGET_INSUFFICIENT: Budget insufficient indicates that we cannot perform a swap because we do\nnot have enough pending budget available. This differs from budget elapsed,\nbecause we still have some budget available, but we have allocated it to\nother swaps.\n - AUTO_REASON_FEE_INSUFFICIENT: Fee insufficient indicates that the fee estimate for a swap is higher than\nthe portion of total swap amount that we allow fees to consume.\n - AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE: No static loop-in candidate indicates that static loop-in autoloop was\nselected, but no full-deposit static candidate fit the rule." + "description": " - AUTO_REASON_BUDGET_NOT_STARTED: Budget not started indicates that we do not recommend any swaps because\nthe start time for our budget has not arrived yet.\n - AUTO_REASON_SWEEP_FEES: Sweep fees indicates that the estimated fees to sweep swaps are too high\nright now.\n - AUTO_REASON_BUDGET_ELAPSED: Budget elapsed indicates that the autoloop budget for the period has been\nelapsed.\n - AUTO_REASON_IN_FLIGHT: In flight indicates that the limit on in-flight automatically dispatched\nswaps has already been reached.\n - AUTO_REASON_SWAP_FEE: Swap fee indicates that the server fee for a specific swap is too high.\n - AUTO_REASON_MINER_FEE: Miner fee indicates that the miner fee for a specific swap is to high.\n - AUTO_REASON_PREPAY: Prepay indicates that the prepay fee for a specific swap is too high.\n - AUTO_REASON_FAILURE_BACKOFF: Failure backoff indicates that a swap has recently failed for this target,\nand the backoff period has not yet passed.\n - AUTO_REASON_LOOP_OUT: Loop out indicates that a loop out swap is currently utilizing the channel,\nso it is not eligible.\n - AUTO_REASON_LOOP_IN: Loop In indicates that a loop in swap is currently in flight for the peer,\nso it is not eligible.\n - AUTO_REASON_LIQUIDITY_OK: Liquidity ok indicates that a target meets the liquidity balance expressed\nin its rule, so no swap is needed.\n - AUTO_REASON_BUDGET_INSUFFICIENT: Budget insufficient indicates that we cannot perform a swap because we do\nnot have enough pending budget available. This differs from budget elapsed,\nbecause we still have some budget available, but we have allocated it to\nother swaps.\n - AUTO_REASON_FEE_INSUFFICIENT: Fee insufficient indicates that the fee estimate for a swap is higher than\nthe portion of total swap amount that we allow fees to consume.\n - AUTO_REASON_STATIC_LOOP_IN_NO_CANDIDATE: No static loop-in candidate indicates that static loop-in autoloop was\nselected, but no full-deposit static candidate fit the rule.\n - AUTO_REASON_CUSTOM_CHANNEL_DATA: Custom channel data indicates that the target channel carries custom\nchannel data and is excluded from the standard autoloop planner." }, "looprpcClientReservation": { "type": "object",