lnrpc: adds PendingHTLCs to ForceClosedChannels

This commit is contained in:
Conner Fromknecht 2017-11-08 19:27:45 -08:00
parent 7408aa6c8d
commit 1f34f117ff
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF
4 changed files with 543 additions and 359 deletions

File diff suppressed because it is too large Load Diff

View File

@ -564,7 +564,15 @@ func RegisterWalletUnlockerHandlerFromEndpoint(ctx context.Context, mux *runtime
// RegisterWalletUnlockerHandler registers the http handlers for service WalletUnlocker to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterWalletUnlockerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
client := NewWalletUnlockerClient(conn)
return RegisterWalletUnlockerHandlerClient(ctx, mux, NewWalletUnlockerClient(conn))
}
// RegisterWalletUnlockerHandler registers the http handlers for service WalletUnlocker to "mux".
// The handlers forward requests to the grpc endpoint over the given implementation of "WalletUnlockerClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WalletUnlockerClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "WalletUnlockerClient" to call the correct interceptors.
func RegisterWalletUnlockerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WalletUnlockerClient) error {
mux.Handle("POST", pattern_WalletUnlocker_CreateWallet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(ctx)
@ -667,7 +675,15 @@ func RegisterLightningHandlerFromEndpoint(ctx context.Context, mux *runtime.Serv
// RegisterLightningHandler registers the http handlers for service Lightning to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
client := NewLightningClient(conn)
return RegisterLightningHandlerClient(ctx, mux, NewLightningClient(conn))
}
// RegisterLightningHandler registers the http handlers for service Lightning to "mux".
// The handlers forward requests to the grpc endpoint over the given implementation of "LightningClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LightningClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "LightningClient" to call the correct interceptors.
func RegisterLightningHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LightningClient) error {
mux.Handle("GET", pattern_Lightning_WalletBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(ctx)

View File

@ -840,6 +840,31 @@ message OpenStatusUpdate {
}
}
message PendingHTLC {
/// The direction within the channel that the htlc was sent
bool incoming = 1 [ json_name = "incoming" ];
/// The total value of the htlc
int64 amount = 2 [ json_name = "amount" ];
/// The final output to be swept back to the user's wallet
string outpoint = 3 [ json_name = "outpoint" ];
/// The next block height at which we can spend the current stage
uint32 maturity_height = 4 [ json_name = "maturity_height" ];
/**
The number of blocks remaining until the current stage can be swept.
Negative values indicate how many blocks have passed since becoming
mature.
*/
int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
/// Indicates whether the htlc is in its first or second stage of recovery
uint32 stage = 6 [ json_name = "stage" ];
}
message PendingChannelRequest {}
message PendingChannelResponse {
message PendingChannel {
@ -894,8 +919,6 @@ message PendingChannelResponse {
/// The pending channel to be force closed
PendingChannel channel = 1 [ json_name = "channel" ];
// TODO(roasbeef): HTLC's as well?
/// The transaction id of the closing transaction
string closing_txid = 2 [ json_name = "closing_txid" ];
@ -905,8 +928,17 @@ message PendingChannelResponse {
/// The height at which funds can be sweeped into the wallet
uint32 maturity_height = 4 [ json_name = "maturity_height" ];
/// Remaining # of blocks until funds can be sweeped into the wallet
uint32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
/*
Remaining # of blocks until the commitment output can be swept.
Negative values indicate how many blocks have passed since becoming
mature.
*/
int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
/// The total value of funds successfully recovered from this channel
int64 recovered_balance = 6 [ json_name = "recovered_balance" ];
repeated PendingHTLC pending_htlcs = 8 [ json_name = "pending_htlcs" ];
}
/// The balance in satoshis encumbered in pending channels

View File

@ -732,8 +732,19 @@
},
"blocks_til_maturity": {
"type": "integer",
"format": "int32",
"description": "Remaining # of blocks until the commitment output can be swept.\nNegative values indicate how many blocks have passed since becoming\nmature."
},
"recovered_balance": {
"type": "string",
"format": "int64",
"title": "/ Remaining # of blocks until funds can be sweeped into the wallet"
"title": "/ The total value of funds successfully recovered from this channel"
},
"pending_htlcs": {
"type": "array",
"items": {
"$ref": "#/definitions/lnrpcPendingHTLC"
}
}
}
},
@ -1743,6 +1754,40 @@
}
}
},
"lnrpcPendingHTLC": {
"type": "object",
"properties": {
"incoming": {
"type": "boolean",
"format": "boolean",
"title": "/ The direction within the channel that the htlc was sent"
},
"amount": {
"type": "string",
"format": "int64",
"title": "/ The total value of the htlc"
},
"outpoint": {
"type": "string",
"title": "/ The final output to be swept back to the user's wallet"
},
"maturity_height": {
"type": "integer",
"format": "int64",
"title": "/ The next block height at which we can spend the current stage"
},
"blocks_til_maturity": {
"type": "integer",
"format": "int32",
"description": "*\nThe number of blocks remaining until the current stage can be swept.\nNegative values indicate how many blocks have passed since becoming\nmature."
},
"stage": {
"type": "integer",
"format": "int64",
"title": "/ Indicates whether the htlc is in its first or second stage of recovery"
}
}
},
"lnrpcPendingUpdate": {
"type": "object",
"properties": {