@@ -145,11 +145,21 @@ message InitWalletRequest {
145145 /**
146146 recovery_window is an optional argument specifying the address lookahead
147147 when restoring a wallet seed. The recovery window applies to each
148- invdividual branch of the BIP44 derivation paths. Supplying a recovery
148+ individual branch of the BIP44 derivation paths. Supplying a recovery
149149 window of zero indicates that no addresses should be recovered, such after
150150 the first initialization of the wallet.
151151 */
152152 int32 recovery_window = 4 ;
153+
154+ /**
155+ channel_backups is an optional argument that allows clients to recover the
156+ settled funds within a set of channels. This should be populated if the
157+ user was unable to close out all channels and sweep funds before partial or
158+ total data loss occurred. If specified, then after on-chain recovery of
159+ funds, lnd begin to carry out the data loss recovery protocol in order to
160+ recover the funds in each channel from a remote force closed transaction.
161+ */
162+ ChanBackupSnapshot channel_backups = 5 ;
153163}
154164message InitWalletResponse {
155165}
@@ -170,6 +180,16 @@ message UnlockWalletRequest {
170180 the first initialization of the wallet.
171181 */
172182 int32 recovery_window = 2 ;
183+
184+ /**
185+ channel_backups is an optional argument that allows clients to recover the
186+ settled funds within a set of channels. This should be populated if the
187+ user was unable to close out all channels and sweep funds before partial or
188+ total data loss occurred. If specified, then after on-chain recovery of
189+ funds, lnd begin to carry out the data loss recovery protocol in order to
190+ recover the funds in each channel from a remote force closed transaction.
191+ */
192+ ChanBackupSnapshot channel_backups = 3 ;
173193}
174194message UnlockWalletResponse {}
175195
@@ -668,7 +688,7 @@ service Lightning {
668688
669689 /** lncli: `fwdinghistory`
670690 ForwardingHistory allows the caller to query the htlcswitch for a record of
671- all HTLC's forwarded within the target time range, and integer offset
691+ all HTLCs forwarded within the target time range, and integer offset
672692 within that time range. If no time-range is specified, then the first chunk
673693 of the past 24 hrs of forwarding history are returned.
674694
@@ -684,6 +704,70 @@ service Lightning {
684704 body : "*"
685705 };
686706 };
707+
708+ /** lncli: `exportchanbackup`
709+ ExportChannelBackup attempts to return an encrypted static channel backup
710+ for the target channel identified by it channel point. The backup is
711+ encrypted with a key generated from the aezeed seed of the user. The
712+ returned backup can either be restored using the RestoreChannelBackup
713+ method once lnd is running, or via the InitWallet and UnlockWallet methods
714+ from the WalletUnlocker service.
715+ */
716+ rpc ExportChannelBackup (ExportChannelBackupRequest ) returns (ChannelBackup ) {
717+ option (google.api.http ) = {
718+ get : "/v1/channels/backup/{chan_point.funding_txid_str}/{chan_point.output_index}"
719+ };
720+ };
721+
722+ /**
723+ ExportAllChannelBackups returns static channel backups for all existing
724+ channels known to lnd. A set of regular singular static channel backups for
725+ each channel are returned. Additionally, a multi-channel backup is returned
726+ as well, which contains a single encrypted blob containing the backups of
727+ each channel.
728+ */
729+ rpc ExportAllChannelBackups (ChanBackupExportRequest ) returns (ChanBackupSnapshot ) {
730+ option (google.api.http ) = {
731+ get : "/v1/channels/backup"
732+ };
733+ };
734+
735+ /**
736+ VerifyChanBackup allows a caller to verify the integrity of a channel backup
737+ snapshot. This method will accept either a packed Single or a packed Multi.
738+ Specifying both will result in an error.
739+ */
740+ rpc VerifyChanBackup (ChanBackupSnapshot ) returns (VerifyChanBackupResponse ) {
741+ option (google.api.http ) = {
742+ post : "/v1/channels/backup/verify"
743+ body : "*"
744+ };
745+ };
746+
747+ /** lncli: `restorechanbackup`
748+ RestoreChannelBackups accepts a set of singular channel backups, or a
749+ single encrypted multi-chan backup and attempts to recover any funds
750+ remaining within the channel. If we are able to unpack the backup, then the
751+ new channel will be shown under listchannels, as well as pending channels.
752+ */
753+ rpc RestoreChannelBackups (RestoreChanBackupRequest ) returns (RestoreBackupResponse ) {
754+ option (google.api.http ) = {
755+ post : "/v1/channels/backup/restore"
756+ body : "*"
757+ };
758+ };
759+
760+ /**
761+ SubscribeChannelBackups allows a client to sub-subscribe to the most up to
762+ date information concerning the state of all channel backups. Each time a
763+ new channel is added, we return the new set of channels, along with a
764+ multi-chan backup containing the backup info for all channels. Each time a
765+ channel is closed, we send a new update, which contains new new chan back
766+ ups, but the updated set of encrypted multi-chan backups with the closed
767+ channel(s) removed.
768+ */
769+ rpc SubscribeChannelBackups (ChannelBackupSubscription ) returns (stream ChanBackupSnapshot ) {
770+ };
687771}
688772
689773message Utxo {
@@ -790,7 +874,14 @@ message SendRequest {
790874 any channel may be used.
791875 */
792876 uint64 outgoing_chan_id = 9 ;
877+
878+ /**
879+ An optional maximum total time lock for the route. If zero, there is no
880+ maximum enforced.
881+ */
882+ uint32 cltv_limit = 10 ;
793883}
884+
794885message SendResponse {
795886 string payment_error = 1 [json_name = "payment_error" ];
796887 bytes payment_preimage = 2 [json_name = "payment_preimage" ];
@@ -1060,9 +1151,8 @@ message Channel {
10601151 repeated HTLC pending_htlcs = 15 [json_name = "pending_htlcs" ];
10611152
10621153 /**
1063- The CSV delay expressed in relative blocks. If the channel is force
1064- closed, we'll need to wait for this many blocks before we can regain our
1065- funds.
1154+ The CSV delay expressed in relative blocks. If the channel is force closed,
1155+ we will need to wait for this many blocks before we can regain our funds.
10661156 */
10671157 uint32 csv_delay = 16 [json_name = "csv_delay" ];
10681158
@@ -1071,6 +1161,9 @@ message Channel {
10711161
10721162 /// True if we were the ones that created the channel.
10731163 bool initiator = 18 [json_name = "initiator" ];
1164+
1165+ /// A set of flags showing the current state of the cahnnel.
1166+ string chan_status_flags = 19 [json_name = "chan_status_flags" ];
10741167}
10751168
10761169
@@ -1163,6 +1256,26 @@ message Peer {
11631256
11641257 /// Ping time to this peer
11651258 int64 ping_time = 9 [json_name = "ping_time" ];
1259+
1260+ enum SyncType {
1261+ /**
1262+ Denotes that we cannot determine the peer's current sync type.
1263+ */
1264+ UNKNOWN_SYNC = 0 ;
1265+
1266+ /**
1267+ Denotes that we are actively receiving new graph updates from the peer.
1268+ */
1269+ ACTIVE_SYNC = 1 ;
1270+
1271+ /**
1272+ Denotes that we are not receiving new graph updates from the peer.
1273+ */
1274+ PASSIVE_SYNC = 2 ;
1275+ }
1276+
1277+ // The type of sync we are currently performing with this peer.
1278+ SyncType sync_type = 10 [json_name = "sync_type" ];
11661279}
11671280
11681281message ListPeersRequest {
@@ -1731,6 +1844,7 @@ message NetworkInfo {
17311844 double avg_channel_size = 7 [json_name = "avg_channel_size" ];
17321845 int64 min_channel_size = 8 [json_name = "min_channel_size" ];
17331846 int64 max_channel_size = 9 [json_name = "max_channel_size" ];
1847+ int64 median_channel_size_sat = 10 [json_name = "median_channel_size_sat" ];
17341848
17351849 // TODO(roasbeef): fee rate info, expiry
17361850 // * also additional RPC for tracking fee info once in
@@ -2182,3 +2296,72 @@ message ForwardingHistoryResponse {
21822296 /// The index of the last time in the set of returned forwarding events. Can be used to seek further, pagination style.
21832297 uint32 last_offset_index = 2 [json_name = "last_offset_index" ];
21842298}
2299+
2300+ message ExportChannelBackupRequest {
2301+ /// The target chanenl point to obtain a back up for.
2302+ ChannelPoint chan_point = 1 ;
2303+ }
2304+
2305+ message ChannelBackup {
2306+ /**
2307+ Identifies the channel that this backup belongs to.
2308+ */
2309+ ChannelPoint chan_point = 1 [ json_name = "chan_point" ];
2310+
2311+ /**
2312+ Is an encrypted single-chan backup. this can be passed to
2313+ RestoreChannelBackups, or the WalletUnlocker Innit and Unlock methods in
2314+ order to trigger the recovery protocol.
2315+ */
2316+ bytes chan_backup = 2 [ json_name = "chan_backup" ];
2317+ }
2318+
2319+ message MultiChanBackup {
2320+ /**
2321+ Is the set of all channels that are included in this multi-channel backup.
2322+ */
2323+ repeated ChannelPoint chan_points = 1 [ json_name = "chan_points" ];
2324+
2325+ /**
2326+ A single encrypted blob containing all the static channel backups of the
2327+ channel listed above. This can be stored as a single file or blob, and
2328+ safely be replaced with any prior/future versions.
2329+ */
2330+ bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
2331+ }
2332+
2333+ message ChanBackupExportRequest {}
2334+ message ChanBackupSnapshot {
2335+ /**
2336+ The set of new channels that have been added since the last channel backup
2337+ snapshot was requested.
2338+ */
2339+ ChannelBackups single_chan_backups = 1 [ json_name = "single_chan_backups" ];
2340+
2341+ /**
2342+ A multi-channel backup that covers all open channels currently known to
2343+ lnd.
2344+ */
2345+ MultiChanBackup multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
2346+ }
2347+
2348+ message ChannelBackups {
2349+ /**
2350+ A set of single-chan static channel backups.
2351+ */
2352+ repeated ChannelBackup chan_backups = 1 [ json_name = "chan_backups" ];
2353+ }
2354+
2355+ message RestoreChanBackupRequest {
2356+ oneof backup {
2357+ ChannelBackups chan_backups = 1 [ json_name = "chan_backups" ];
2358+
2359+ bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
2360+ }
2361+ }
2362+ message RestoreBackupResponse {}
2363+
2364+ message ChannelBackupSubscription {}
2365+
2366+ message VerifyChanBackupResponse {
2367+ }
0 commit comments