loop: add support for the probe API

This commit is contained in:
Andras Banki-Horvath 2021-05-10 16:55:53 +02:00
parent 7d044f58e8
commit f786aaa016
No known key found for this signature in database
GPG key ID: 80E5375C094198D8
20 changed files with 2118 additions and 849 deletions

View file

@ -43,13 +43,17 @@ const (
// canceling loop out swaps.
ProtocolVersionLoopOutCancel = 7
// ProtocolVerionProbe indicates that the client is able to request
// the server to perform a probe to test inbound liquidty.
ProtocolVersionProbe ProtocolVersion = 8
// ProtocolVersionUnrecorded is set for swaps were created before we
// started saving protocol version with swaps.
ProtocolVersionUnrecorded ProtocolVersion = math.MaxUint32
// CurrentRPCProtocolVersion defines the version of the RPC protocol
// that is currently supported by the loop client.
CurrentRPCProtocolVersion = looprpc.ProtocolVersion_LOOP_OUT_CANCEL
CurrentRPCProtocolVersion = looprpc.ProtocolVersion_PROBE
// CurrentInternalProtocolVersion defines the RPC current protocol in
// the internal representation.
@ -88,6 +92,9 @@ func (p ProtocolVersion) String() string {
case ProtocolVersionLoopOutCancel:
return "Loop Out Cancel"
case ProtocolVersionProbe:
return "Probe"
default:
return "Unknown"
}

View file

@ -22,6 +22,7 @@ func TestProtocolVersionSanity(t *testing.T) {
ProtocolVersionHtlcV2,
ProtocolVersionMultiLoopIn,
ProtocolVersionLoopOutCancel,
ProtocolVersionProbe,
}
rpcVersions := [...]looprpc.ProtocolVersion{
@ -33,6 +34,7 @@ func TestProtocolVersionSanity(t *testing.T) {
looprpc.ProtocolVersion_HTLC_V2,
looprpc.ProtocolVersion_MULTI_LOOP_IN,
looprpc.ProtocolVersion_LOOP_OUT_CANCEL,
looprpc.ProtocolVersion_PROBE,
}
require.Equal(t, len(versions), len(rpcVersions))