Browse Source

Merge pull request #379 from LN-Zap/feature/lnd-recovery

Feature/lnd recovery
renovate/lint-staged-8.x
JimmyMow 7 years ago
committed by GitHub
parent
commit
14bd5f6b5f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/components/Onboarding/Login.js
  2. 31
      app/components/Onboarding/Onboarding.js
  3. 37
      app/components/Onboarding/RecoverForm.js
  4. 61
      app/components/Onboarding/RecoverForm.scss
  5. 6
      app/containers/Root.js
  6. 118
      app/lnd/config/rpc.proto
  7. 118
      app/lnd/lib/rpc.proto
  8. 3
      app/lnd/methods/walletController.js
  9. 118
      app/rpc.proto

1
app/components/Onboarding/Login.js

@ -33,7 +33,6 @@ const Login = ({
} }
</span> </span>
</div> </div>
<div>Recover existing wallet</div>
</section> </section>
</div> </div>
) )

31
app/components/Onboarding/Onboarding.js

@ -8,6 +8,7 @@ import Alias from './Alias'
import Autopilot from './Autopilot' import Autopilot from './Autopilot'
import Login from './Login' import Login from './Login'
import Signup from './Signup' import Signup from './Signup'
import RecoverForm from './RecoverForm'
import NewWalletSeed from './NewWalletSeed' import NewWalletSeed from './NewWalletSeed'
import ReEnterSeed from './ReEnterSeed' import ReEnterSeed from './ReEnterSeed'
import NewWalletPassword from './NewWalletPassword' import NewWalletPassword from './NewWalletPassword'
@ -31,6 +32,7 @@ const Onboarding = ({
aliasProps, aliasProps,
initWalletProps, initWalletProps,
autopilotProps, autopilotProps,
recoverFormProps,
newWalletSeedProps, newWalletSeedProps,
newWalletPasswordProps, newWalletPasswordProps,
newAezeedPasswordProps, newAezeedPasswordProps,
@ -93,11 +95,37 @@ const Onboarding = ({
title={'Alright, let\'s get set up'} title={'Alright, let\'s get set up'}
description='Would you like to create a new wallet or import an existing one?' // eslint-disable-line description='Would you like to create a new wallet or import an existing one?' // eslint-disable-line
back={() => changeStep(4)} back={() => changeStep(4)}
next={() => (initWalletProps.signupProps.signupForm.create ? changeStep(6) : console.log('import'))} next={() => (initWalletProps.signupProps.signupForm.create ? changeStep(6) : changeStep(5.1))}
> >
<Signup {...initWalletProps.signupProps} /> <Signup {...initWalletProps.signupProps} />
</FormContainer> </FormContainer>
) )
case 5.1:
return (
<FormContainer
title='Import your seed'
description={'Recovering a wallet, nice. You don\'t need anyone else, you got yourself :)'} // eslint-disable-line
back={() => changeStep(5)}
next={() => changeStep(5.2)}
>
<RecoverForm {...recoverFormProps} />
</FormContainer>
)
case 5.2:
return (
<FormContainer
title='Seed passphrase'
description={'Enter your cipherseed passphrase (or just submit if you don\'t have one)'} // eslint-disable-line
back={() => changeStep(5)}
next={() => {
const recoverySeed = recoverFormProps.seedInput.map(input => input.word)
submitNewWallet(createWalletPassword, recoverySeed, aezeedPassword)
}}
>
<NewAezeedPassword {...newAezeedPasswordProps} />
</FormContainer>
)
case 6: case 6:
return ( return (
<FormContainer <FormContainer
@ -164,6 +192,7 @@ Onboarding.propTypes = {
newWalletSeedProps: PropTypes.object.isRequired, newWalletSeedProps: PropTypes.object.isRequired,
newWalletPasswordProps: PropTypes.object.isRequired, newWalletPasswordProps: PropTypes.object.isRequired,
newAezeedPasswordProps: PropTypes.object.isRequired, newAezeedPasswordProps: PropTypes.object.isRequired,
recoverFormProps: PropTypes.object.isRequired,
reEnterSeedProps: PropTypes.object.isRequired, reEnterSeedProps: PropTypes.object.isRequired,
changeStep: PropTypes.func.isRequired, changeStep: PropTypes.func.isRequired,
startLnd: PropTypes.func.isRequired, startLnd: PropTypes.func.isRequired,

37
app/components/Onboarding/RecoverForm.js

@ -0,0 +1,37 @@
import React from 'react'
import PropTypes from 'prop-types'
import styles from './RecoverForm.scss'
const RecoverForm = ({ seedInput, updateSeedInput }) => (
<div className={styles.container}>
<ul className={styles.seedContainer}>
{
Array(24).fill('').map((word, index) => (
<li key={index}>
<section>
<label htmlFor={index}>{index + 1}</label>
</section>
<section>
<input
type='text'
id={index}
placeholder='word'
value={seedInput[index] ? seedInput[index].word : ''}
onChange={event => updateSeedInput({ word: event.target.value, index })}
className={styles.word}
/>
</section>
</li>
))
}
</ul>
</div>
)
RecoverForm.propTypes = {
seedInput: PropTypes.array.isRequired,
updateSeedInput: PropTypes.func.isRequired
}
export default RecoverForm

61
app/components/Onboarding/RecoverForm.scss

@ -0,0 +1,61 @@
@import '../../variables.scss';
.seedContainer {
position: relative;
display: inline-block;
font-size: 12px;
li {
display: inline-block;
margin: 5px 0;
width: 25%;
section {
display: inline-block;
vertical-align: middle;
color: $white;
&:nth-child(1) {
width: 15%;
text-align: center;
opacity: 0.5;
}
&:nth-child(2) {
width: calc(85% - 10px);
margin: 0 5px;
}
}
}
}
.word {
margin: 0 3px;
background-color: #1c1e26;
outline: 0;
border: none;
padding: 5px 10px;
color: $white;
font-family: courier;
font-family: 'Courier';
&.valid {
color: $green;
}
&.invalid {
color: $red;
}
}
.word::-webkit-input-placeholder {
text-shadow: none;
-webkit-text-fill-color: initial;
}
.contentEditable {
width: 100px;
background: red;
}

6
app/containers/Root.js

@ -118,6 +118,11 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
updateAezeedPasswordConfirmation: dispatchProps.updateAezeedPasswordConfirmation updateAezeedPasswordConfirmation: dispatchProps.updateAezeedPasswordConfirmation
} }
const recoverFormProps = {
seedInput: stateProps.onboarding.seedInput,
updateSeedInput: dispatchProps.updateSeedInput
}
const reEnterSeedProps = { const reEnterSeedProps = {
seed: stateProps.onboarding.seed, seed: stateProps.onboarding.seed,
seedInput: stateProps.onboarding.seedInput, seedInput: stateProps.onboarding.seedInput,
@ -136,6 +141,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
newWalletSeedProps, newWalletSeedProps,
newWalletPasswordProps, newWalletPasswordProps,
newAezeedPasswordProps, newAezeedPasswordProps,
recoverFormProps,
reEnterSeedProps reEnterSeedProps
} }

118
app/lnd/config/rpc.proto

@ -127,6 +127,15 @@ message InitWalletRequest {
to encrypt the generated aezeed cipher seed. to encrypt the generated aezeed cipher seed.
*/ */
bytes aezeed_passphrase = 3; bytes aezeed_passphrase = 3;
/**
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
invdividual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 4;
} }
message InitWalletResponse { message InitWalletResponse {
} }
@ -138,6 +147,15 @@ message UnlockWalletRequest {
function properly. function properly.
*/ */
bytes wallet_password = 1; bytes wallet_password = 1;
/**
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
invdividual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 2;
} }
message UnlockWalletResponse {} message UnlockWalletResponse {}
@ -743,7 +761,7 @@ message HTLC {
uint32 expiration_height = 4 [json_name = "expiration_height"]; uint32 expiration_height = 4 [json_name = "expiration_height"];
} }
message ActiveChannel { message Channel {
/// Whether this channel is active or not /// Whether this channel is active or not
bool active = 1 [json_name = "active"]; bool active = 1 [json_name = "active"];
@ -782,7 +800,7 @@ message ActiveChannel {
int64 commit_fee = 8 [json_name = "commit_fee"]; int64 commit_fee = 8 [json_name = "commit_fee"];
/// The weight of the commitment transaction /// The weight of the commitment transaction
int64 commit_weight = 9 [ json_name = "commit_weight" ]; int64 commit_weight = 9 [json_name = "commit_weight"];
/** /**
The required number of satoshis per kilo-weight that the requester will pay The required number of satoshis per kilo-weight that the requester will pay
@ -819,14 +837,21 @@ message ActiveChannel {
closed, we'll need to wait for this many blocks before we can regain our closed, we'll need to wait for this many blocks before we can regain our
funds. funds.
*/ */
uint32 csv_delay = 16 [ json_name = "csv_delay" ]; uint32 csv_delay = 16 [json_name = "csv_delay"];
/// Whether this channel is advertised to the network or not
bool private = 17 [json_name = "private"];
} }
message ListChannelsRequest { message ListChannelsRequest {
bool active_only = 1;
bool inactive_only = 2;
bool public_only = 3;
bool private_only = 4;
} }
message ListChannelsResponse { message ListChannelsResponse {
/// The list of active channels /// The list of active channels
repeated ActiveChannel channels = 11 [json_name = "channels"]; repeated Channel channels = 11 [json_name = "channels"];
} }
message Peer { message Peer {
@ -901,6 +926,10 @@ message GetInfoResponse {
/// Timestamp of the block best known to the wallet /// Timestamp of the block best known to the wallet
int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ]; int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ];
/// The version of the LND software that the node is running.
string version = 14 [ json_name = "version" ];
} }
message ConfirmationUpdate { message ConfirmationUpdate {
@ -965,10 +994,10 @@ message OpenChannelRequest {
/// The number of satoshis to push to the remote side as part of the initial commitment state /// The number of satoshis to push to the remote side as part of the initial commitment state
int64 push_sat = 5 [json_name = "push_sat"]; int64 push_sat = 5 [json_name = "push_sat"];
/// The target number of blocks that the closure transaction should be confirmed by. /// The target number of blocks that the funding transaction should be confirmed by.
int32 target_conf = 6; int32 target_conf = 6;
/// A manual fee rate set in sat/byte that should be used when crafting the closure transaction. /// A manual fee rate set in sat/byte that should be used when crafting the funding transaction.
int64 sat_per_byte = 7; int64 sat_per_byte = 7;
/// Whether this channel should be private, not announced to the greater network. /// Whether this channel should be private, not announced to the greater network.
@ -976,6 +1005,9 @@ message OpenChannelRequest {
/// The minimum value in millisatoshi we will require for incoming HTLCs on the channel. /// The minimum value in millisatoshi we will require for incoming HTLCs on the channel.
int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"]; int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"];
/// The delay we require on the remote's commitment transaction. If this is not set, it will be scaled automatically with the channel size.
uint32 remote_csv_delay = 10 [json_name = "remote_csv_delay"];
} }
message OpenStatusUpdate { message OpenStatusUpdate {
oneof update { oneof update {
@ -1049,6 +1081,14 @@ message PendingChannelsResponse {
int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ]; int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ];
} }
message WaitingCloseChannel {
/// The pending channel waiting for closing tx to confirm
PendingChannel channel = 1;
/// The balance in satoshis encumbered in this channel
int64 limbo_balance = 2 [ json_name = "limbo_balance" ];
}
message ClosedChannel { message ClosedChannel {
/// The pending channel to be closed /// The pending channel to be closed
PendingChannel channel = 1; PendingChannel channel = 1;
@ -1094,6 +1134,9 @@ message PendingChannelsResponse {
/// Channels pending force closing /// Channels pending force closing
repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ]; repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ];
/// Channels waiting for closing tx to confirm
repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ];
} }
message WalletBalanceRequest { message WalletBalanceRequest {
@ -1114,6 +1157,9 @@ message ChannelBalanceRequest {
message ChannelBalanceResponse { message ChannelBalanceResponse {
/// Sum of channels balances denominated in satoshis /// Sum of channels balances denominated in satoshis
int64 balance = 1 [json_name = "balance"]; int64 balance = 1 [json_name = "balance"];
/// Sum of channels pending balances denominated in satoshis
int64 pending_open_balance = 2 [json_name = "pending_open_balance"];
} }
message QueryRoutesRequest { message QueryRoutesRequest {
@ -1138,9 +1184,11 @@ message Hop {
*/ */
uint64 chan_id = 1 [json_name = "chan_id"]; uint64 chan_id = 1 [json_name = "chan_id"];
int64 chan_capacity = 2 [json_name = "chan_capacity"]; int64 chan_capacity = 2 [json_name = "chan_capacity"];
int64 amt_to_forward = 3 [json_name = "amt_to_forward"]; int64 amt_to_forward = 3 [json_name = "amt_to_forward", deprecated = true];
int64 fee = 4 [json_name = "fee"]; int64 fee = 4 [json_name = "fee", deprecated = true];
uint32 expiry = 5 [json_name = "expiry"]; uint32 expiry = 5 [json_name = "expiry"];
int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"];
int64 fee_msat = 7 [json_name = "fee_msat"];
} }
/** /**
@ -1165,7 +1213,7 @@ message Route {
of a one-hop payment, this value will be zero as we don't need to pay a fee of a one-hop payment, this value will be zero as we don't need to pay a fee
it ourself. it ourself.
*/ */
int64 total_fees = 2 [json_name = "total_fees"]; int64 total_fees = 2 [json_name = "total_fees", deprecated = true];
/** /**
The total amount of funds required to complete a payment over this route. The total amount of funds required to complete a payment over this route.
@ -1174,12 +1222,22 @@ message Route {
satoshis, otherwise the route will fail at an intermediate node due to an satoshis, otherwise the route will fail at an intermediate node due to an
insufficient amount of fees. insufficient amount of fees.
*/ */
int64 total_amt = 3 [json_name = "total_amt"]; int64 total_amt = 3 [json_name = "total_amt", deprecated = true];
/** /**
Contains details concerning the specific forwarding details at each hop. Contains details concerning the specific forwarding details at each hop.
*/ */
repeated Hop hops = 4 [json_name = "hops"]; repeated Hop hops = 4 [json_name = "hops"];
/**
The total fees in millisatoshis.
*/
int64 total_fees_msat = 5 [json_name = "total_fees_msat"];
/**
The total amount in millisatoshis.
*/
int64 total_amt_msat = 6 [json_name = "total_amt_msat"];
} }
message NodeInfoRequest { message NodeInfoRequest {
@ -1230,7 +1288,7 @@ message RoutingPolicy {
/** /**
A fully authenticated channel along with all its unique attributes. A fully authenticated channel along with all its unique attributes.
Once an authenticated channel announcement has been processed on the network, Once an authenticated channel announcement has been processed on the network,
then a instance of ChannelEdgeInfo encapsulating the channels attributes is then an instance of ChannelEdgeInfo encapsulating the channels attributes is
stored. The other portions relevant to routing policy of a channel are stored stored. The other portions relevant to routing policy of a channel are stored
within a ChannelEdgePolicy for each direction of the channel. within a ChannelEdgePolicy for each direction of the channel.
*/ */
@ -1340,6 +1398,34 @@ message ClosedChannelUpdate {
ChannelPoint chan_point = 4; ChannelPoint chan_point = 4;
} }
message HopHint {
/// The public key of the node at the start of the channel.
string node_id = 1 [json_name = "node_id"];
/// The unique identifier of the channel.
uint64 chan_id = 2 [json_name = "chan_id"];
/// The base fee of the channel denominated in millisatoshis.
uint32 fee_base_msat = 3 [json_name = "fee_base_msat"];
/**
The fee rate of the channel for sending one satoshi across it denominated in
millionths of a satoshi.
*/
uint32 fee_proportional_millionths = 4 [json_name = "fee_proportional_millionths"];
/// The time-lock delta of the channel.
uint32 cltv_expiry_delta = 5 [json_name = "cltv_expiry_delta"];
}
message RouteHint {
/**
A list of hop hints that when chained together can assist in reaching a
specific destination.
*/
repeated HopHint hop_hints = 1 [json_name = "hop_hints"];
}
message Invoice { message Invoice {
/** /**
An optional memo to attach along with the invoice. Used for record keeping An optional memo to attach along with the invoice. Used for record keeping
@ -1395,6 +1481,15 @@ message Invoice {
/// Delta to use for the time-lock of the CLTV extended to the final hop. /// Delta to use for the time-lock of the CLTV extended to the final hop.
uint64 cltv_expiry = 13 [json_name = "cltv_expiry"]; uint64 cltv_expiry = 13 [json_name = "cltv_expiry"];
/**
Route hints that can each be individually used to assist in reaching the
invoice's destination.
*/
repeated RouteHint route_hints = 14 [json_name = "route_hints"];
/// Whether this invoice should include routing hints for private channels.
bool private = 15 [json_name = "private"];
} }
message AddInvoiceResponse { message AddInvoiceResponse {
bytes r_hash = 1 [json_name = "r_hash"]; bytes r_hash = 1 [json_name = "r_hash"];
@ -1484,6 +1579,7 @@ message PayReq {
string description_hash = 7 [json_name = "description_hash"]; string description_hash = 7 [json_name = "description_hash"];
string fallback_addr = 8 [json_name = "fallback_addr"]; string fallback_addr = 8 [json_name = "fallback_addr"];
int64 cltv_expiry = 9 [json_name = "cltv_expiry"]; int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
repeated RouteHint route_hints = 10 [json_name = "route_hints"];
} }
message FeeReportRequest {} message FeeReportRequest {}

118
app/lnd/lib/rpc.proto

@ -127,6 +127,15 @@ message InitWalletRequest {
to encrypt the generated aezeed cipher seed. to encrypt the generated aezeed cipher seed.
*/ */
bytes aezeed_passphrase = 3; bytes aezeed_passphrase = 3;
/**
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
invdividual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 4;
} }
message InitWalletResponse { message InitWalletResponse {
} }
@ -138,6 +147,15 @@ message UnlockWalletRequest {
function properly. function properly.
*/ */
bytes wallet_password = 1; bytes wallet_password = 1;
/**
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
invdividual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 2;
} }
message UnlockWalletResponse {} message UnlockWalletResponse {}
@ -743,7 +761,7 @@ message HTLC {
uint32 expiration_height = 4 [json_name = "expiration_height"]; uint32 expiration_height = 4 [json_name = "expiration_height"];
} }
message ActiveChannel { message Channel {
/// Whether this channel is active or not /// Whether this channel is active or not
bool active = 1 [json_name = "active"]; bool active = 1 [json_name = "active"];
@ -782,7 +800,7 @@ message ActiveChannel {
int64 commit_fee = 8 [json_name = "commit_fee"]; int64 commit_fee = 8 [json_name = "commit_fee"];
/// The weight of the commitment transaction /// The weight of the commitment transaction
int64 commit_weight = 9 [ json_name = "commit_weight" ]; int64 commit_weight = 9 [json_name = "commit_weight"];
/** /**
The required number of satoshis per kilo-weight that the requester will pay The required number of satoshis per kilo-weight that the requester will pay
@ -819,14 +837,21 @@ message ActiveChannel {
closed, we'll need to wait for this many blocks before we can regain our closed, we'll need to wait for this many blocks before we can regain our
funds. funds.
*/ */
uint32 csv_delay = 16 [ json_name = "csv_delay" ]; uint32 csv_delay = 16 [json_name = "csv_delay"];
/// Whether this channel is advertised to the network or not
bool private = 17 [json_name = "private"];
} }
message ListChannelsRequest { message ListChannelsRequest {
bool active_only = 1;
bool inactive_only = 2;
bool public_only = 3;
bool private_only = 4;
} }
message ListChannelsResponse { message ListChannelsResponse {
/// The list of active channels /// The list of active channels
repeated ActiveChannel channels = 11 [json_name = "channels"]; repeated Channel channels = 11 [json_name = "channels"];
} }
message Peer { message Peer {
@ -901,6 +926,10 @@ message GetInfoResponse {
/// Timestamp of the block best known to the wallet /// Timestamp of the block best known to the wallet
int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ]; int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ];
/// The version of the LND software that the node is running.
string version = 14 [ json_name = "version" ];
} }
message ConfirmationUpdate { message ConfirmationUpdate {
@ -965,10 +994,10 @@ message OpenChannelRequest {
/// The number of satoshis to push to the remote side as part of the initial commitment state /// The number of satoshis to push to the remote side as part of the initial commitment state
int64 push_sat = 5 [json_name = "push_sat"]; int64 push_sat = 5 [json_name = "push_sat"];
/// The target number of blocks that the closure transaction should be confirmed by. /// The target number of blocks that the funding transaction should be confirmed by.
int32 target_conf = 6; int32 target_conf = 6;
/// A manual fee rate set in sat/byte that should be used when crafting the closure transaction. /// A manual fee rate set in sat/byte that should be used when crafting the funding transaction.
int64 sat_per_byte = 7; int64 sat_per_byte = 7;
/// Whether this channel should be private, not announced to the greater network. /// Whether this channel should be private, not announced to the greater network.
@ -976,6 +1005,9 @@ message OpenChannelRequest {
/// The minimum value in millisatoshi we will require for incoming HTLCs on the channel. /// The minimum value in millisatoshi we will require for incoming HTLCs on the channel.
int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"]; int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"];
/// The delay we require on the remote's commitment transaction. If this is not set, it will be scaled automatically with the channel size.
uint32 remote_csv_delay = 10 [json_name = "remote_csv_delay"];
} }
message OpenStatusUpdate { message OpenStatusUpdate {
oneof update { oneof update {
@ -1049,6 +1081,14 @@ message PendingChannelsResponse {
int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ]; int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ];
} }
message WaitingCloseChannel {
/// The pending channel waiting for closing tx to confirm
PendingChannel channel = 1;
/// The balance in satoshis encumbered in this channel
int64 limbo_balance = 2 [ json_name = "limbo_balance" ];
}
message ClosedChannel { message ClosedChannel {
/// The pending channel to be closed /// The pending channel to be closed
PendingChannel channel = 1; PendingChannel channel = 1;
@ -1094,6 +1134,9 @@ message PendingChannelsResponse {
/// Channels pending force closing /// Channels pending force closing
repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ]; repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ];
/// Channels waiting for closing tx to confirm
repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ];
} }
message WalletBalanceRequest { message WalletBalanceRequest {
@ -1114,6 +1157,9 @@ message ChannelBalanceRequest {
message ChannelBalanceResponse { message ChannelBalanceResponse {
/// Sum of channels balances denominated in satoshis /// Sum of channels balances denominated in satoshis
int64 balance = 1 [json_name = "balance"]; int64 balance = 1 [json_name = "balance"];
/// Sum of channels pending balances denominated in satoshis
int64 pending_open_balance = 2 [json_name = "pending_open_balance"];
} }
message QueryRoutesRequest { message QueryRoutesRequest {
@ -1138,9 +1184,11 @@ message Hop {
*/ */
uint64 chan_id = 1 [json_name = "chan_id"]; uint64 chan_id = 1 [json_name = "chan_id"];
int64 chan_capacity = 2 [json_name = "chan_capacity"]; int64 chan_capacity = 2 [json_name = "chan_capacity"];
int64 amt_to_forward = 3 [json_name = "amt_to_forward"]; int64 amt_to_forward = 3 [json_name = "amt_to_forward", deprecated = true];
int64 fee = 4 [json_name = "fee"]; int64 fee = 4 [json_name = "fee", deprecated = true];
uint32 expiry = 5 [json_name = "expiry"]; uint32 expiry = 5 [json_name = "expiry"];
int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"];
int64 fee_msat = 7 [json_name = "fee_msat"];
} }
/** /**
@ -1165,7 +1213,7 @@ message Route {
of a one-hop payment, this value will be zero as we don't need to pay a fee of a one-hop payment, this value will be zero as we don't need to pay a fee
it ourself. it ourself.
*/ */
int64 total_fees = 2 [json_name = "total_fees"]; int64 total_fees = 2 [json_name = "total_fees", deprecated = true];
/** /**
The total amount of funds required to complete a payment over this route. The total amount of funds required to complete a payment over this route.
@ -1174,12 +1222,22 @@ message Route {
satoshis, otherwise the route will fail at an intermediate node due to an satoshis, otherwise the route will fail at an intermediate node due to an
insufficient amount of fees. insufficient amount of fees.
*/ */
int64 total_amt = 3 [json_name = "total_amt"]; int64 total_amt = 3 [json_name = "total_amt", deprecated = true];
/** /**
Contains details concerning the specific forwarding details at each hop. Contains details concerning the specific forwarding details at each hop.
*/ */
repeated Hop hops = 4 [json_name = "hops"]; repeated Hop hops = 4 [json_name = "hops"];
/**
The total fees in millisatoshis.
*/
int64 total_fees_msat = 5 [json_name = "total_fees_msat"];
/**
The total amount in millisatoshis.
*/
int64 total_amt_msat = 6 [json_name = "total_amt_msat"];
} }
message NodeInfoRequest { message NodeInfoRequest {
@ -1230,7 +1288,7 @@ message RoutingPolicy {
/** /**
A fully authenticated channel along with all its unique attributes. A fully authenticated channel along with all its unique attributes.
Once an authenticated channel announcement has been processed on the network, Once an authenticated channel announcement has been processed on the network,
then a instance of ChannelEdgeInfo encapsulating the channels attributes is then an instance of ChannelEdgeInfo encapsulating the channels attributes is
stored. The other portions relevant to routing policy of a channel are stored stored. The other portions relevant to routing policy of a channel are stored
within a ChannelEdgePolicy for each direction of the channel. within a ChannelEdgePolicy for each direction of the channel.
*/ */
@ -1340,6 +1398,34 @@ message ClosedChannelUpdate {
ChannelPoint chan_point = 4; ChannelPoint chan_point = 4;
} }
message HopHint {
/// The public key of the node at the start of the channel.
string node_id = 1 [json_name = "node_id"];
/// The unique identifier of the channel.
uint64 chan_id = 2 [json_name = "chan_id"];
/// The base fee of the channel denominated in millisatoshis.
uint32 fee_base_msat = 3 [json_name = "fee_base_msat"];
/**
The fee rate of the channel for sending one satoshi across it denominated in
millionths of a satoshi.
*/
uint32 fee_proportional_millionths = 4 [json_name = "fee_proportional_millionths"];
/// The time-lock delta of the channel.
uint32 cltv_expiry_delta = 5 [json_name = "cltv_expiry_delta"];
}
message RouteHint {
/**
A list of hop hints that when chained together can assist in reaching a
specific destination.
*/
repeated HopHint hop_hints = 1 [json_name = "hop_hints"];
}
message Invoice { message Invoice {
/** /**
An optional memo to attach along with the invoice. Used for record keeping An optional memo to attach along with the invoice. Used for record keeping
@ -1395,6 +1481,15 @@ message Invoice {
/// Delta to use for the time-lock of the CLTV extended to the final hop. /// Delta to use for the time-lock of the CLTV extended to the final hop.
uint64 cltv_expiry = 13 [json_name = "cltv_expiry"]; uint64 cltv_expiry = 13 [json_name = "cltv_expiry"];
/**
Route hints that can each be individually used to assist in reaching the
invoice's destination.
*/
repeated RouteHint route_hints = 14 [json_name = "route_hints"];
/// Whether this invoice should include routing hints for private channels.
bool private = 15 [json_name = "private"];
} }
message AddInvoiceResponse { message AddInvoiceResponse {
bytes r_hash = 1 [json_name = "r_hash"]; bytes r_hash = 1 [json_name = "r_hash"];
@ -1484,6 +1579,7 @@ message PayReq {
string description_hash = 7 [json_name = "description_hash"]; string description_hash = 7 [json_name = "description_hash"];
string fallback_addr = 8 [json_name = "fallback_addr"]; string fallback_addr = 8 [json_name = "fallback_addr"];
int64 cltv_expiry = 9 [json_name = "cltv_expiry"]; int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
repeated RouteHint route_hints = 10 [json_name = "route_hints"];
} }
message FeeReportRequest {} message FeeReportRequest {}

3
app/lnd/methods/walletController.js

@ -130,7 +130,8 @@ export function initWallet(walletUnlocker, { wallet_password, cipher_seed_mnemon
walletUnlocker.initWallet({ walletUnlocker.initWallet({
wallet_password, wallet_password,
cipher_seed_mnemonic, cipher_seed_mnemonic,
aezeed_passphrase: Buffer.from(aezeed_passphrase, 'hex') aezeed_passphrase: Buffer.from(aezeed_passphrase, 'hex'),
recovery_window: 250
}, (err, data) => { }, (err, data) => {
if (err) { reject(err) } if (err) { reject(err) }

118
app/rpc.proto

@ -127,6 +127,15 @@ message InitWalletRequest {
to encrypt the generated aezeed cipher seed. to encrypt the generated aezeed cipher seed.
*/ */
bytes aezeed_passphrase = 3; bytes aezeed_passphrase = 3;
/**
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
invdividual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 4;
} }
message InitWalletResponse { message InitWalletResponse {
} }
@ -138,6 +147,15 @@ message UnlockWalletRequest {
function properly. function properly.
*/ */
bytes wallet_password = 1; bytes wallet_password = 1;
/**
recovery_window is an optional argument specifying the address lookahead
when restoring a wallet seed. The recovery window applies to each
invdividual branch of the BIP44 derivation paths. Supplying a recovery
window of zero indicates that no addresses should be recovered, such after
the first initialization of the wallet.
*/
int32 recovery_window = 2;
} }
message UnlockWalletResponse {} message UnlockWalletResponse {}
@ -743,7 +761,7 @@ message HTLC {
uint32 expiration_height = 4 [json_name = "expiration_height"]; uint32 expiration_height = 4 [json_name = "expiration_height"];
} }
message ActiveChannel { message Channel {
/// Whether this channel is active or not /// Whether this channel is active or not
bool active = 1 [json_name = "active"]; bool active = 1 [json_name = "active"];
@ -782,7 +800,7 @@ message ActiveChannel {
int64 commit_fee = 8 [json_name = "commit_fee"]; int64 commit_fee = 8 [json_name = "commit_fee"];
/// The weight of the commitment transaction /// The weight of the commitment transaction
int64 commit_weight = 9 [ json_name = "commit_weight" ]; int64 commit_weight = 9 [json_name = "commit_weight"];
/** /**
The required number of satoshis per kilo-weight that the requester will pay The required number of satoshis per kilo-weight that the requester will pay
@ -819,14 +837,21 @@ message ActiveChannel {
closed, we'll need to wait for this many blocks before we can regain our closed, we'll need to wait for this many blocks before we can regain our
funds. funds.
*/ */
uint32 csv_delay = 16 [ json_name = "csv_delay" ]; uint32 csv_delay = 16 [json_name = "csv_delay"];
/// Whether this channel is advertised to the network or not
bool private = 17 [json_name = "private"];
} }
message ListChannelsRequest { message ListChannelsRequest {
bool active_only = 1;
bool inactive_only = 2;
bool public_only = 3;
bool private_only = 4;
} }
message ListChannelsResponse { message ListChannelsResponse {
/// The list of active channels /// The list of active channels
repeated ActiveChannel channels = 11 [json_name = "channels"]; repeated Channel channels = 11 [json_name = "channels"];
} }
message Peer { message Peer {
@ -901,6 +926,10 @@ message GetInfoResponse {
/// Timestamp of the block best known to the wallet /// Timestamp of the block best known to the wallet
int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ]; int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ];
/// The version of the LND software that the node is running.
string version = 14 [ json_name = "version" ];
} }
message ConfirmationUpdate { message ConfirmationUpdate {
@ -965,10 +994,10 @@ message OpenChannelRequest {
/// The number of satoshis to push to the remote side as part of the initial commitment state /// The number of satoshis to push to the remote side as part of the initial commitment state
int64 push_sat = 5 [json_name = "push_sat"]; int64 push_sat = 5 [json_name = "push_sat"];
/// The target number of blocks that the closure transaction should be confirmed by. /// The target number of blocks that the funding transaction should be confirmed by.
int32 target_conf = 6; int32 target_conf = 6;
/// A manual fee rate set in sat/byte that should be used when crafting the closure transaction. /// A manual fee rate set in sat/byte that should be used when crafting the funding transaction.
int64 sat_per_byte = 7; int64 sat_per_byte = 7;
/// Whether this channel should be private, not announced to the greater network. /// Whether this channel should be private, not announced to the greater network.
@ -976,6 +1005,9 @@ message OpenChannelRequest {
/// The minimum value in millisatoshi we will require for incoming HTLCs on the channel. /// The minimum value in millisatoshi we will require for incoming HTLCs on the channel.
int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"]; int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"];
/// The delay we require on the remote's commitment transaction. If this is not set, it will be scaled automatically with the channel size.
uint32 remote_csv_delay = 10 [json_name = "remote_csv_delay"];
} }
message OpenStatusUpdate { message OpenStatusUpdate {
oneof update { oneof update {
@ -1049,6 +1081,14 @@ message PendingChannelsResponse {
int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ]; int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ];
} }
message WaitingCloseChannel {
/// The pending channel waiting for closing tx to confirm
PendingChannel channel = 1;
/// The balance in satoshis encumbered in this channel
int64 limbo_balance = 2 [ json_name = "limbo_balance" ];
}
message ClosedChannel { message ClosedChannel {
/// The pending channel to be closed /// The pending channel to be closed
PendingChannel channel = 1; PendingChannel channel = 1;
@ -1094,6 +1134,9 @@ message PendingChannelsResponse {
/// Channels pending force closing /// Channels pending force closing
repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ]; repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ];
/// Channels waiting for closing tx to confirm
repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ];
} }
message WalletBalanceRequest { message WalletBalanceRequest {
@ -1114,6 +1157,9 @@ message ChannelBalanceRequest {
message ChannelBalanceResponse { message ChannelBalanceResponse {
/// Sum of channels balances denominated in satoshis /// Sum of channels balances denominated in satoshis
int64 balance = 1 [json_name = "balance"]; int64 balance = 1 [json_name = "balance"];
/// Sum of channels pending balances denominated in satoshis
int64 pending_open_balance = 2 [json_name = "pending_open_balance"];
} }
message QueryRoutesRequest { message QueryRoutesRequest {
@ -1138,9 +1184,11 @@ message Hop {
*/ */
uint64 chan_id = 1 [json_name = "chan_id"]; uint64 chan_id = 1 [json_name = "chan_id"];
int64 chan_capacity = 2 [json_name = "chan_capacity"]; int64 chan_capacity = 2 [json_name = "chan_capacity"];
int64 amt_to_forward = 3 [json_name = "amt_to_forward"]; int64 amt_to_forward = 3 [json_name = "amt_to_forward", deprecated = true];
int64 fee = 4 [json_name = "fee"]; int64 fee = 4 [json_name = "fee", deprecated = true];
uint32 expiry = 5 [json_name = "expiry"]; uint32 expiry = 5 [json_name = "expiry"];
int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"];
int64 fee_msat = 7 [json_name = "fee_msat"];
} }
/** /**
@ -1165,7 +1213,7 @@ message Route {
of a one-hop payment, this value will be zero as we don't need to pay a fee of a one-hop payment, this value will be zero as we don't need to pay a fee
it ourself. it ourself.
*/ */
int64 total_fees = 2 [json_name = "total_fees"]; int64 total_fees = 2 [json_name = "total_fees", deprecated = true];
/** /**
The total amount of funds required to complete a payment over this route. The total amount of funds required to complete a payment over this route.
@ -1174,12 +1222,22 @@ message Route {
satoshis, otherwise the route will fail at an intermediate node due to an satoshis, otherwise the route will fail at an intermediate node due to an
insufficient amount of fees. insufficient amount of fees.
*/ */
int64 total_amt = 3 [json_name = "total_amt"]; int64 total_amt = 3 [json_name = "total_amt", deprecated = true];
/** /**
Contains details concerning the specific forwarding details at each hop. Contains details concerning the specific forwarding details at each hop.
*/ */
repeated Hop hops = 4 [json_name = "hops"]; repeated Hop hops = 4 [json_name = "hops"];
/**
The total fees in millisatoshis.
*/
int64 total_fees_msat = 5 [json_name = "total_fees_msat"];
/**
The total amount in millisatoshis.
*/
int64 total_amt_msat = 6 [json_name = "total_amt_msat"];
} }
message NodeInfoRequest { message NodeInfoRequest {
@ -1230,7 +1288,7 @@ message RoutingPolicy {
/** /**
A fully authenticated channel along with all its unique attributes. A fully authenticated channel along with all its unique attributes.
Once an authenticated channel announcement has been processed on the network, Once an authenticated channel announcement has been processed on the network,
then a instance of ChannelEdgeInfo encapsulating the channels attributes is then an instance of ChannelEdgeInfo encapsulating the channels attributes is
stored. The other portions relevant to routing policy of a channel are stored stored. The other portions relevant to routing policy of a channel are stored
within a ChannelEdgePolicy for each direction of the channel. within a ChannelEdgePolicy for each direction of the channel.
*/ */
@ -1340,6 +1398,34 @@ message ClosedChannelUpdate {
ChannelPoint chan_point = 4; ChannelPoint chan_point = 4;
} }
message HopHint {
/// The public key of the node at the start of the channel.
string node_id = 1 [json_name = "node_id"];
/// The unique identifier of the channel.
uint64 chan_id = 2 [json_name = "chan_id"];
/// The base fee of the channel denominated in millisatoshis.
uint32 fee_base_msat = 3 [json_name = "fee_base_msat"];
/**
The fee rate of the channel for sending one satoshi across it denominated in
millionths of a satoshi.
*/
uint32 fee_proportional_millionths = 4 [json_name = "fee_proportional_millionths"];
/// The time-lock delta of the channel.
uint32 cltv_expiry_delta = 5 [json_name = "cltv_expiry_delta"];
}
message RouteHint {
/**
A list of hop hints that when chained together can assist in reaching a
specific destination.
*/
repeated HopHint hop_hints = 1 [json_name = "hop_hints"];
}
message Invoice { message Invoice {
/** /**
An optional memo to attach along with the invoice. Used for record keeping An optional memo to attach along with the invoice. Used for record keeping
@ -1395,6 +1481,15 @@ message Invoice {
/// Delta to use for the time-lock of the CLTV extended to the final hop. /// Delta to use for the time-lock of the CLTV extended to the final hop.
uint64 cltv_expiry = 13 [json_name = "cltv_expiry"]; uint64 cltv_expiry = 13 [json_name = "cltv_expiry"];
/**
Route hints that can each be individually used to assist in reaching the
invoice's destination.
*/
repeated RouteHint route_hints = 14 [json_name = "route_hints"];
/// Whether this invoice should include routing hints for private channels.
bool private = 15 [json_name = "private"];
} }
message AddInvoiceResponse { message AddInvoiceResponse {
bytes r_hash = 1 [json_name = "r_hash"]; bytes r_hash = 1 [json_name = "r_hash"];
@ -1484,6 +1579,7 @@ message PayReq {
string description_hash = 7 [json_name = "description_hash"]; string description_hash = 7 [json_name = "description_hash"];
string fallback_addr = 8 [json_name = "fallback_addr"]; string fallback_addr = 8 [json_name = "fallback_addr"];
int64 cltv_expiry = 9 [json_name = "cltv_expiry"]; int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
repeated RouteHint route_hints = 10 [json_name = "route_hints"];
} }
message FeeReportRequest {} message FeeReportRequest {}

Loading…
Cancel
Save