Skip to content

Commit 8612912

Browse files
committed
looprpc: abandon swap api
swaprpc: abandon swap api
1 parent b280753 commit 8612912

File tree

8 files changed

+398
-152
lines changed

8 files changed

+398
-152
lines changed

looprpc/client.pb.go

Lines changed: 279 additions & 131 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

looprpc/client.proto

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ service SwapClient {
4343
*/
4444
rpc SwapInfo (SwapInfoRequest) returns (SwapStatus);
4545

46+
/* loop: `abandonswap`
47+
AbandonSwap allows the client to abandon a swap.
48+
*/
49+
rpc AbandonSwap (AbandonSwapRequest) returns (AbandonSwapResponse);
50+
4651
/* loop: `terms`
4752
LoopOutTerms returns the terms that the server enforces for a loop out swap.
4853
*/
@@ -524,6 +529,12 @@ enum FailureReason {
524529
because the amount extended by an external loop in htlc is insufficient.
525530
*/
526531
FAILURE_REASON_INCORRECT_AMOUNT = 6;
532+
533+
/*
534+
FAILURE_REASON_ABANDONED indicates that a swap permanently failed because
535+
the client manually abandoned the swap.
536+
*/
537+
FAILURE_REASON_ABANDONED = 7;
527538
}
528539

529540
message ListSwapsRequest {
@@ -1180,3 +1191,21 @@ message SuggestSwapsResponse {
11801191
*/
11811192
repeated Disqualified disqualified = 2;
11821193
}
1194+
1195+
message AbandonSwapRequest {
1196+
/*
1197+
The swap identifier which currently is the hash that locks the HTLCs. When
1198+
using REST, this field must be encoded as URL safe base64.
1199+
*/
1200+
bytes id = 1;
1201+
1202+
/*
1203+
A flag that tries to ensure that the client understands that they are
1204+
risking loss of funds by abandoning a swap. This could happen if an
1205+
abandoned swap would wait on a timeout sweep by the client.
1206+
*/
1207+
bool i_know_what_i_am_doing = 2;
1208+
}
1209+
1210+
message AbandonSwapResponse {
1211+
}

looprpc/client.swagger.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@
492492
}
493493
},
494494
"definitions": {
495+
"looprpcAbandonSwapResponse": {
496+
"type": "object"
497+
},
495498
"looprpcAddressType": {
496499
"type": "string",
497500
"enum": [
@@ -551,10 +554,11 @@
551554
"FAILURE_REASON_SWEEP_TIMEOUT",
552555
"FAILURE_REASON_INSUFFICIENT_VALUE",
553556
"FAILURE_REASON_TEMPORARY",
554-
"FAILURE_REASON_INCORRECT_AMOUNT"
557+
"FAILURE_REASON_INCORRECT_AMOUNT",
558+
"FAILURE_REASON_ABANDONED"
555559
],
556560
"default": "FAILURE_REASON_NONE",
557-
"description": " - FAILURE_REASON_NONE: FAILURE_REASON_NONE is set when the swap did not fail, it is either in\nprogress or succeeded.\n - FAILURE_REASON_OFFCHAIN: FAILURE_REASON_OFFCHAIN indicates that a loop out failed because it wasn't\npossible to find a route for one or both off chain payments that met the fee\nand timelock limits required.\n - FAILURE_REASON_TIMEOUT: FAILURE_REASON_TIMEOUT indicates that the swap failed because on chain htlc\ndid not confirm before its expiry, or it confirmed too late for us to reveal\nour preimage and claim.\n - FAILURE_REASON_SWEEP_TIMEOUT: FAILURE_REASON_SWEEP_TIMEOUT indicates that a loop out permanently failed\nbecause the on chain htlc wasn't swept before the server revoked the\nhtlc.\n - FAILURE_REASON_INSUFFICIENT_VALUE: FAILURE_REASON_INSUFFICIENT_VALUE indicates that a loop out has failed\nbecause the on chain htlc had a lower value than requested.\n - FAILURE_REASON_TEMPORARY: FAILURE_REASON_TEMPORARY indicates that a swap cannot continue due to an\ninternal error. Manual intervention such as a restart is required.\n - FAILURE_REASON_INCORRECT_AMOUNT: FAILURE_REASON_INCORRECT_AMOUNT indicates that a loop in permanently failed\nbecause the amount extended by an external loop in htlc is insufficient."
561+
"description": " - FAILURE_REASON_NONE: FAILURE_REASON_NONE is set when the swap did not fail, it is either in\nprogress or succeeded.\n - FAILURE_REASON_OFFCHAIN: FAILURE_REASON_OFFCHAIN indicates that a loop out failed because it wasn't\npossible to find a route for one or both off chain payments that met the fee\nand timelock limits required.\n - FAILURE_REASON_TIMEOUT: FAILURE_REASON_TIMEOUT indicates that the swap failed because on chain htlc\ndid not confirm before its expiry, or it confirmed too late for us to reveal\nour preimage and claim.\n - FAILURE_REASON_SWEEP_TIMEOUT: FAILURE_REASON_SWEEP_TIMEOUT indicates that a loop out permanently failed\nbecause the on chain htlc wasn't swept before the server revoked the\nhtlc.\n - FAILURE_REASON_INSUFFICIENT_VALUE: FAILURE_REASON_INSUFFICIENT_VALUE indicates that a loop out has failed\nbecause the on chain htlc had a lower value than requested.\n - FAILURE_REASON_TEMPORARY: FAILURE_REASON_TEMPORARY indicates that a swap cannot continue due to an\ninternal error. Manual intervention such as a restart is required.\n - FAILURE_REASON_INCORRECT_AMOUNT: FAILURE_REASON_INCORRECT_AMOUNT indicates that a loop in permanently failed\nbecause the amount extended by an external loop in htlc is insufficient.\n - FAILURE_REASON_ABANDONED: FAILURE_REASON_ABANDONED indicates that a swap permanently failed because\nthe client manually abandoned the swap."
558562
},
559563
"looprpcGetInfoResponse": {
560564
"type": "object",

looprpc/client_grpc.pb.go

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

looprpc/debug.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

looprpc/swapclient.pb.json.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swapserverrpc/common.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swapserverrpc/server.pb.go

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)