Merge pull request #401 from shocknet/fix/lnd13

up protos and change err locked
This commit is contained in:
CapDog 2021-06-21 13:49:40 -04:00 committed by GitHub
commit 3a677e5caa
6 changed files with 857 additions and 2849 deletions

View file

@ -40,9 +40,10 @@ service Router {
}
/*
SendToRouteV2 attempts to make a payment via the specified route. This method
differs from SendPayment in that it allows users to specify a full route
manually. This can be used for things like rebalancing, and atomic swaps.
SendToRouteV2 attempts to make a payment via the specified route. This
method differs from SendPayment in that it allows users to specify a full
route manually. This can be used for things like rebalancing, and atomic
swaps.
*/
rpc SendToRouteV2 (SendToRouteRequest) returns (lnrpc.HTLCAttempt);
@ -60,6 +61,28 @@ service Router {
rpc QueryMissionControl (QueryMissionControlRequest)
returns (QueryMissionControlResponse);
/*
XImportMissionControl is an experimental API that imports the state provided
to the internal mission control's state, using all results which are more
recent than our existing values. These values will only be imported
in-memory, and will not be persisted across restarts.
*/
rpc XImportMissionControl (XImportMissionControlRequest)
returns (XImportMissionControlResponse);
/*
GetMissionControlConfig returns mission control's current config.
*/
rpc GetMissionControlConfig (GetMissionControlConfigRequest)
returns (GetMissionControlConfigResponse);
/*
SetMissionControlConfig will set mission control's config, if the config
provided is valid.
*/
rpc SetMissionControlConfig (SetMissionControlConfigRequest)
returns (SetMissionControlConfigResponse);
/*
QueryProbability returns the current success probability estimate for a
given node pair and amount.
@ -82,7 +105,7 @@ service Router {
returns (stream HtlcEvent);
/*
Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
described by the passed PaymentRequest to the final destination. The call
returns a stream of payment status updates.
*/
@ -97,6 +120,25 @@ service Router {
rpc TrackPayment (TrackPaymentRequest) returns (stream PaymentStatus) {
option deprecated = true;
}
/**
HtlcInterceptor dispatches a bi-directional streaming RPC in which
Forwarded HTLC requests are sent to the client and the client responds with
a boolean that tells LND if this htlc should be intercepted.
In case of interception, the htlc can be either settled, cancelled or
resumed later by using the ResolveHoldForward endpoint.
*/
rpc HtlcInterceptor (stream ForwardHtlcInterceptResponse)
returns (stream ForwardHtlcInterceptRequest);
/*
UpdateChanStatus attempts to manually set the state of a channel
(enabled, disabled, or auto). A manual "disable" request will cause the
channel to stay disabled until a subsequent manual request of either
"enable" or "auto".
*/
rpc UpdateChanStatus (UpdateChanStatusRequest)
returns (UpdateChanStatusResponse);
}
message SendPaymentRequest {
@ -126,6 +168,9 @@ message SendPaymentRequest {
*/
int32 final_cltv_delta = 4;
// An optional payment addr to be included within the last hop of the route.
bytes payment_addr = 20;
/*
A bare-bones invoice for a payment within the Lightning Network. With the
details of the invoice, the sender has all the data necessary to send a
@ -226,6 +271,19 @@ message SendPaymentRequest {
that show which htlcs are still in flight are suppressed.
*/
bool no_inflight_updates = 18;
/*
The largest payment split that should be attempted when making a payment if
splitting is necessary. Setting this value will effectively cause lnd to
split more aggressively, vs only when it thinks it needs to. Note that this
value is in milli-satoshis.
*/
uint64 max_shard_size_msat = 21;
/*
If set, an AMP-payment will be attempted.
*/
bool amp = 22;
}
message TrackPaymentRequest {
@ -299,6 +357,14 @@ message QueryMissionControlResponse {
repeated PairHistory pairs = 2;
}
message XImportMissionControlRequest {
// Node pair-level mission control state to be imported.
repeated PairHistory pairs = 1;
}
message XImportMissionControlResponse {
}
// PairHistory contains the mission control state for a particular node pair.
message PairHistory {
// The source node pubkey of the pair.
@ -340,6 +406,67 @@ message PairData {
int64 success_amt_msat = 7;
}
message GetMissionControlConfigRequest {
}
message GetMissionControlConfigResponse {
/*
Mission control's currently active config.
*/
MissionControlConfig config = 1;
}
message SetMissionControlConfigRequest {
/*
The config to set for mission control. Note that all values *must* be set,
because the full config will be applied.
*/
MissionControlConfig config = 1;
}
message SetMissionControlConfigResponse {
}
message MissionControlConfig {
/*
The amount of time mission control will take to restore a penalized node
or channel back to 50% success probability, expressed in seconds. Setting
this value to a higher value will penalize failures for longer, making
mission control less likely to route through nodes and channels that we
have previously recorded failures for.
*/
uint64 half_life_seconds = 1;
/*
The probability of success mission control should assign to hop in a route
where it has no other information available. Higher values will make mission
control more willing to try hops that we have no information about, lower
values will discourage trying these hops.
*/
float hop_probability = 2;
/*
The importance that mission control should place on historical results,
expressed as a value in [0;1]. Setting this value to 1 will ignore all
historical payments and just use the hop probability to assess the
probability of success for each hop. A zero value ignores hop probability
completely and relies entirely on historical results, unless none are
available.
*/
float weight = 3;
/*
The maximum number of payment results that mission control will store.
*/
uint32 maximum_payment_results = 4;
/*
The minimum time that must have passed since the previously recorded failure
before we raise the failure amount.
*/
uint64 minimum_failure_relax_interval = 5;
}
message QueryProbabilityRequest {
// The source node pubkey of the pair.
bytes from_node = 1;
@ -383,6 +510,9 @@ message BuildRouteRequest {
pubkey.
*/
repeated bytes hop_pubkeys = 4;
// An optional payment addr to be included within the last hop of the route.
bytes payment_addr = 5;
}
message BuildRouteResponse {
@ -579,3 +709,90 @@ message PaymentStatus {
repeated lnrpc.HTLCAttempt htlcs = 4;
}
message CircuitKey {
/// The id of the channel that the is part of this circuit.
uint64 chan_id = 1;
/// The index of the incoming htlc in the incoming channel.
uint64 htlc_id = 2;
}
message ForwardHtlcInterceptRequest {
/*
The key of this forwarded htlc. It defines the incoming channel id and
the index in this channel.
*/
CircuitKey incoming_circuit_key = 1;
// The incoming htlc amount.
uint64 incoming_amount_msat = 5;
// The incoming htlc expiry.
uint32 incoming_expiry = 6;
/*
The htlc payment hash. This value is not guaranteed to be unique per
request.
*/
bytes payment_hash = 2;
// The requested outgoing channel id for this forwarded htlc. Because of
// non-strict forwarding, this isn't necessarily the channel over which the
// packet will be forwarded eventually. A different channel to the same peer
// may be selected as well.
uint64 outgoing_requested_chan_id = 7;
// The outgoing htlc amount.
uint64 outgoing_amount_msat = 3;
// The outgoing htlc expiry.
uint32 outgoing_expiry = 4;
// Any custom records that were present in the payload.
map<uint64, bytes> custom_records = 8;
// The onion blob for the next hop
bytes onion_blob = 9;
}
/**
ForwardHtlcInterceptResponse enables the caller to resolve a previously hold
forward. The caller can choose either to:
- `Resume`: Execute the default behavior (usually forward).
- `Reject`: Fail the htlc backwards.
- `Settle`: Settle this htlc with a given preimage.
*/
message ForwardHtlcInterceptResponse {
/**
The key of this forwarded htlc. It defines the incoming channel id and
the index in this channel.
*/
CircuitKey incoming_circuit_key = 1;
// The resolve action for this intercepted htlc.
ResolveHoldForwardAction action = 2;
// The preimage in case the resolve action is Settle.
bytes preimage = 3;
}
enum ResolveHoldForwardAction {
SETTLE = 0;
FAIL = 1;
RESUME = 2;
}
message UpdateChanStatusRequest {
lnrpc.ChannelPoint chan_point = 1;
ChanStatusAction action = 2;
}
enum ChanStatusAction {
ENABLE = 0;
DISABLE = 1;
AUTO = 2;
}
message UpdateChanStatusResponse {
}

View file

@ -32,8 +32,9 @@ service Lightning {
rpc WalletBalance (WalletBalanceRequest) returns (WalletBalanceResponse);
/* lncli: `channelbalance`
ChannelBalance returns the total funds available across all open channels
in satoshis.
ChannelBalance returns a report on the total funds across all open channels,
categorized in local/remote, pending local/remote and unsettled local/remote
balances.
*/
rpc ChannelBalance (ChannelBalanceRequest) returns (ChannelBalanceResponse);
@ -46,13 +47,18 @@ service Lightning {
/* lncli: `estimatefee`
EstimateFee asks the chain backend to estimate the fee rate and total fees
for a transaction that pays to multiple specified outputs.
When using REST, the `AddrToAmount` map type can be set by appending
`&AddrToAmount[<address>]=<amount_to_send>` to the URL. Unfortunately this
map type doesn't appear in the REST API documentation because of a bug in
the grpc-gateway library.
*/
rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse);
/* lncli: `sendcoins`
SendCoins executes a request to send coins to a particular address. Unlike
SendMany, this RPC call only allows creating a single output at a time. If
neither target_conf, or sat_per_byte are set, then the internal wallet will
neither target_conf, or sat_per_vbyte are set, then the internal wallet will
consult its fee model to determine a fee for the default confirmation
target.
*/
@ -76,7 +82,7 @@ service Lightning {
/* lncli: `sendmany`
SendMany handles a request for a transaction that creates multiple specified
outputs in parallel. If neither target_conf, or sat_per_byte are set, then
outputs in parallel. If neither target_conf, or sat_per_vbyte are set, then
the internal wallet will consult its fee model to determine a fee for the
default confirmation target.
*/
@ -135,6 +141,14 @@ service Lightning {
*/
rpc GetInfo (GetInfoRequest) returns (GetInfoResponse);
/** lncli: `getrecoveryinfo`
GetRecoveryInfo returns information concerning the recovery mode including
whether it's in a recovery mode, whether the recovery is finished, and the
progress made so far.
*/
rpc GetRecoveryInfo (GetRecoveryInfoRequest)
returns (GetRecoveryInfoResponse);
// TODO(roasbeef): merge with below with bool?
/* lncli: `pendingchannels`
PendingChannels returns a list of all the channels that are currently
@ -222,8 +236,10 @@ service Lightning {
/* lncli: `abandonchannel`
AbandonChannel removes all channel state from the database except for a
close summary. This method can be used to get rid of permanently unusable
channels due to bugs fixed in newer versions of lnd. Only available
when in debug builds of lnd.
channels due to bugs fixed in newer versions of lnd. This method can also be
used to remove externally funded channels where the funding transaction was
never broadcast. Only available for non-externally funded channels in dev
build.
*/
rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse);
@ -355,6 +371,11 @@ service Lightning {
satoshis. The returned route contains the full details required to craft and
send an HTLC, also including the necessary information that should be
present within the Sphinx packet encapsulated within the HTLC.
When using REST, the `dest_custom_records` map type can be set by appending
`&dest_custom_records[<record_number>]=<record_data_base64_url_encoded>`
to the URL. Unfortunately this map type doesn't appear in the REST API
documentation because of a bug in the grpc-gateway library.
*/
rpc QueryRoutes (QueryRoutesRequest) returns (QueryRoutesResponse);
@ -405,8 +426,9 @@ service Lightning {
/* lncli: `fwdinghistory`
ForwardingHistory allows the caller to query the htlcswitch for a record of
all HTLCs forwarded within the target time range, and integer offset
within that time range. If no time-range is specified, then the first chunk
of the past 24 hrs of forwarding history are returned.
within that time range, for a maximum number of events. If no maximum number
of events is specified, up to 100 events will be returned. If no time-range
is specified, then events will be returned in the order that they occured.
A list of forwarding events are returned. The size of each forwarding event
is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
@ -473,6 +495,26 @@ service Lightning {
offline.
*/
rpc BakeMacaroon (BakeMacaroonRequest) returns (BakeMacaroonResponse);
/* lncli: `listmacaroonids`
ListMacaroonIDs returns all root key IDs that are in use.
*/
rpc ListMacaroonIDs (ListMacaroonIDsRequest)
returns (ListMacaroonIDsResponse);
/* lncli: `deletemacaroonid`
DeleteMacaroonID deletes the specified macaroon ID and invalidates all
macaroons derived from that ID.
*/
rpc DeleteMacaroonID (DeleteMacaroonIDRequest)
returns (DeleteMacaroonIDResponse);
/* lncli: `listpermissions`
ListPermissions lists all RPC method URIs and their required macaroon
permissions to access them.
*/
rpc ListPermissions (ListPermissionsRequest)
returns (ListPermissionsResponse);
}
message Utxo {
@ -541,6 +583,9 @@ message GetTransactionsRequest {
default to this option.
*/
int32 end_height = 2;
// An optional filter to only include transactions relevant to an account.
string account = 3;
}
message TransactionDetails {
@ -667,6 +712,11 @@ message SendRequest {
fallback.
*/
repeated FeatureBit dest_features = 15;
/*
The payment address of the generated invoice.
*/
bytes payment_addr = 16;
}
message SendResponse {
@ -750,6 +800,58 @@ message ChannelAcceptResponse {
// The pending channel id to which this response applies.
bytes pending_chan_id = 2;
/*
An optional error to send the initiating party to indicate why the channel
was rejected. This field *should not* contain sensitive information, it will
be sent to the initiating party. This field should only be set if accept is
false, the channel will be rejected if an error is set with accept=true
because the meaning of this response is ambiguous. Limited to 500
characters.
*/
string error = 3;
/*
The upfront shutdown address to use if the initiating peer supports option
upfront shutdown script (see ListPeers for the features supported). Note
that the channel open will fail if this value is set for a peer that does
not support this feature bit.
*/
string upfront_shutdown = 4;
/*
The csv delay (in blocks) that we require for the remote party.
*/
uint32 csv_delay = 5;
/*
The reserve amount in satoshis that we require the remote peer to adhere to.
We require that the remote peer always have some reserve amount allocated to
them so that there is always a disincentive to broadcast old state (if they
hold 0 sats on their side of the channel, there is nothing to lose).
*/
uint64 reserve_sat = 6;
/*
The maximum amount of funds in millisatoshis that we allow the remote peer
to have in outstanding htlcs.
*/
uint64 in_flight_max_msat = 7;
/*
The maximum number of htlcs that the remote peer can offer us.
*/
uint32 max_htlc_count = 8;
/*
The minimum value in millisatoshis for incoming htlcs on the channel.
*/
uint64 min_htlc_in = 9;
/*
The number of confirmations we require before we consider the channel open.
*/
uint32 min_accept_depth = 10;
}
message ChannelPoint {
@ -798,14 +900,25 @@ message EstimateFeeRequest {
// The target number of blocks that this transaction should be confirmed
// by.
int32 target_conf = 2;
// The minimum number of confirmations each one of your outputs used for
// the transaction must satisfy.
int32 min_confs = 3;
// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 4;
}
message EstimateFeeResponse {
// The total fee in satoshis.
int64 fee_sat = 1;
// The fee rate in satoshi/byte.
int64 feerate_sat_per_byte = 2;
// Deprecated, use sat_per_vbyte.
// The fee rate in satoshi/vbyte.
int64 feerate_sat_per_byte = 2 [deprecated = true];
// The fee rate in satoshi/vbyte.
uint64 sat_per_vbyte = 3;
}
message SendManyRequest {
@ -816,12 +929,24 @@ message SendManyRequest {
// by.
int32 target_conf = 3;
// A manual fee rate set in sat/byte that should be used when crafting the
// A manual fee rate set in sat/vbyte that should be used when crafting the
// transaction.
int64 sat_per_byte = 5;
uint64 sat_per_vbyte = 4;
// Deprecated, use sat_per_vbyte.
// A manual fee rate set in sat/vbyte that should be used when crafting the
// transaction.
int64 sat_per_byte = 5 [deprecated = true];
// An optional label for the transaction, limited to 500 characters.
string label = 6;
// The minimum number of confirmations each one of your outputs used for
// the transaction must satisfy.
int32 min_confs = 7;
// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 8;
}
message SendManyResponse {
// The id of the transaction
@ -839,9 +964,14 @@ message SendCoinsRequest {
// by.
int32 target_conf = 3;
// A manual fee rate set in sat/byte that should be used when crafting the
// A manual fee rate set in sat/vbyte that should be used when crafting the
// transaction.
int64 sat_per_byte = 5;
uint64 sat_per_vbyte = 4;
// Deprecated, use sat_per_vbyte.
// A manual fee rate set in sat/vbyte that should be used when crafting the
// transaction.
int64 sat_per_byte = 5 [deprecated = true];
/*
If set, then the amount field will be ignored, and lnd will attempt to
@ -852,6 +982,13 @@ message SendCoinsRequest {
// An optional label for the transaction, limited to 500 characters.
string label = 7;
// The minimum number of confirmations each one of your outputs used for
// the transaction must satisfy.
int32 min_confs = 8;
// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 9;
}
message SendCoinsResponse {
// The transaction ID of the transaction
@ -864,6 +1001,9 @@ message ListUnspentRequest {
// The maximum number of confirmations to be included.
int32 max_confs = 2;
// An optional filter to only include outputs belonging to an account.
string account = 3;
}
message ListUnspentResponse {
// A list of utxos
@ -884,8 +1024,14 @@ enum AddressType {
}
message NewAddressRequest {
// The address type
// The type of address to generate.
AddressType type = 1;
/*
The name of the account to generate a new address for. If empty, the
default wallet account is used.
*/
string account = 2;
}
message NewAddressResponse {
// The newly generated wallet address
@ -929,6 +1075,12 @@ message ConnectPeerRequest {
/* If set, the daemon will attempt to persistently connect to the target
* peer. Otherwise, the call will be synchronous. */
bool perm = 2;
/*
The connection timeout value (in seconds) for this request. It won't affect
other requests.
*/
uint64 timeout = 3;
}
message ConnectPeerResponse {
}
@ -945,6 +1097,21 @@ message HTLC {
int64 amount = 2;
bytes hash_lock = 3;
uint32 expiration_height = 4;
// Index identifying the htlc on the channel.
uint64 htlc_index = 5;
// If this HTLC is involved in a forwarding operation, this field indicates
// the forwarding channel. For an outgoing htlc, it is the incoming channel.
// For an incoming htlc, it is the outgoing channel. When the htlc
// originates from this node or this node is the final destination,
// forwarding_channel will be zero. The forwarding channel will also be zero
// for htlcs that need to be forwarded but don't have a forwarding decision
// persisted yet.
uint64 forwarding_channel = 6;
// Index identifying the htlc on the forwarding channel.
uint64 forwarding_htlc_index = 7;
}
enum CommitmentType {
@ -975,6 +1142,30 @@ enum CommitmentType {
UNKNOWN_COMMITMENT_TYPE = 999;
}
message ChannelConstraints {
/*
The CSV delay expressed in relative blocks. If the channel is force closed,
we will need to wait for this many blocks before we can regain our funds.
*/
uint32 csv_delay = 1;
// The minimum satoshis this node is required to reserve in its balance.
uint64 chan_reserve_sat = 2;
// The dust limit (in satoshis) of the initiator's commitment tx.
uint64 dust_limit_sat = 3;
// The maximum amount of coins in millisatoshis that can be pending in this
// channel.
uint64 max_pending_amt_msat = 4;
// The smallest HTLC in millisatoshis that the initiator will accept.
uint64 min_htlc_msat = 5;
// The total number of incoming HTLC's that the initiator will accept.
uint32 max_accepted_htlcs = 6;
}
message Channel {
// Whether this channel is active or not
bool active = 1;
@ -1047,10 +1238,11 @@ message Channel {
repeated HTLC pending_htlcs = 15;
/*
The CSV delay expressed in relative blocks. If the channel is force closed,
we will need to wait for this many blocks before we can regain our funds.
Deprecated. The CSV delay expressed in relative blocks. If the channel is
force closed, we will need to wait for this many blocks before we can regain
our funds.
*/
uint32 csv_delay = 16;
uint32 csv_delay = 16 [deprecated = true];
// Whether this channel is advertised to the network or not.
bool private = 17;
@ -1061,13 +1253,15 @@ message Channel {
// A set of flags showing the current state of the channel.
string chan_status_flags = 19;
// The minimum satoshis this node is required to reserve in its balance.
int64 local_chan_reserve_sat = 20;
// Deprecated. The minimum satoshis this node is required to reserve in its
// balance.
int64 local_chan_reserve_sat = 20 [deprecated = true];
/*
The minimum satoshis the other node is required to reserve in its balance.
Deprecated. The minimum satoshis the other node is required to reserve in
its balance.
*/
int64 remote_chan_reserve_sat = 21;
int64 remote_chan_reserve_sat = 21 [deprecated = true];
// Deprecated. Use commitment_type.
bool static_remote_key = 22 [deprecated = true];
@ -1112,9 +1306,17 @@ message Channel {
frozen channel doest not allow a cooperative channel close by the
initiator. The thaw_height is the height that this restriction stops
applying to the channel. This field is optional, not setting it or using a
value of zero will mean the channel has no additional restrictions.
value of zero will mean the channel has no additional restrictions. The
height can be interpreted in two ways: as a relative height if the value is
less than 500,000, or as an absolute height otherwise.
*/
uint32 thaw_height = 28;
// List constraints for the local node.
ChannelConstraints local_constraints = 29;
// List constraints for the remote node.
ChannelConstraints remote_constraints = 30;
}
message ListChannelsRequest {
@ -1196,6 +1398,79 @@ message ChannelCloseSummary {
force closes, although only one party's close will be confirmed on chain.
*/
Initiator close_initiator = 12;
repeated Resolution resolutions = 13;
}
enum ResolutionType {
TYPE_UNKNOWN = 0;
// We resolved an anchor output.
ANCHOR = 1;
/*
We are resolving an incoming htlc on chain. This if this htlc is
claimed, we swept the incoming htlc with the preimage. If it is timed
out, our peer swept the timeout path.
*/
INCOMING_HTLC = 2;
/*
We are resolving an outgoing htlc on chain. If this htlc is claimed,
the remote party swept the htlc with the preimage. If it is timed out,
we swept it with the timeout path.
*/
OUTGOING_HTLC = 3;
// We force closed and need to sweep our time locked commitment output.
COMMIT = 4;
}
enum ResolutionOutcome {
// Outcome unknown.
OUTCOME_UNKNOWN = 0;
// An output was claimed on chain.
CLAIMED = 1;
// An output was left unclaimed on chain.
UNCLAIMED = 2;
/*
ResolverOutcomeAbandoned indicates that an output that we did not
claim on chain, for example an anchor that we did not sweep and a
third party claimed on chain, or a htlc that we could not decode
so left unclaimed.
*/
ABANDONED = 3;
/*
If we force closed our channel, our htlcs need to be claimed in two
stages. This outcome represents the broadcast of a timeout or success
transaction for this two stage htlc claim.
*/
FIRST_STAGE = 4;
// A htlc was timed out on chain.
TIMEOUT = 5;
}
message Resolution {
// The type of output we are resolving.
ResolutionType resolution_type = 1;
// The outcome of our on chain action that resolved the outpoint.
ResolutionOutcome outcome = 2;
// The outpoint that was spent by the resolution.
OutPoint outpoint = 3;
// The amount that was claimed by the resolution.
uint64 amount_sat = 4;
// The hex-encoded transaction ID of the sweep transaction that spent the
// output.
string sweep_txid = 5;
}
message ClosedChannelsRequest {
@ -1251,6 +1526,11 @@ message Peer {
Denotes that we are not receiving new graph updates from the peer.
*/
PASSIVE_SYNC = 2;
/*
Denotes that this peer is pinned into an active sync.
*/
PINNED_SYNC = 3;
}
// The type of sync we are currently performing with this peer.
@ -1267,6 +1547,20 @@ message Peer {
spamming us with errors at no cost.
*/
repeated TimestampedError errors = 12;
/*
The number of times we have recorded this peer going offline or coming
online, recorded across restarts. Note that this value is decreased over
time if the peer has not recently flapped, so that we can forgive peers
with historically high flap counts.
*/
int32 flap_count = 13;
/*
The timestamp of the last flap we observed for this peer. If this value is
zero, we have not observed any flaps for this peer.
*/
int64 last_flap_ns = 14;
}
message TimestampedError {
@ -1371,6 +1665,19 @@ message GetInfoResponse {
map<uint32, Feature> features = 19;
}
message GetRecoveryInfoRequest {
}
message GetRecoveryInfoResponse {
// Whether the wallet is in recovery mode
bool recovery_mode = 1;
// Whether the wallet recovery progress is finished
bool recovery_finished = 2;
// The recovery progress, ranging from 0 to 1.
double progress = 3;
}
message Chain {
// The blockchain the node is on (eg bitcoin, litecoin)
string chain = 1;
@ -1412,9 +1719,10 @@ message CloseChannelRequest {
// confirmed by.
int32 target_conf = 3;
// A manual fee rate set in sat/byte that should be used when crafting the
// Deprecated, use sat_per_vbyte.
// A manual fee rate set in sat/vbyte that should be used when crafting the
// closure transaction.
int64 sat_per_byte = 4;
int64 sat_per_byte = 4 [deprecated = true];
/*
An optional address to send funds to in the case of a cooperative close.
@ -1423,6 +1731,10 @@ message CloseChannelRequest {
to the upfront shutdown addresss.
*/
string delivery_address = 5;
// A manual fee rate set in sat/vbyte that should be used when crafting the
// closure transaction.
uint64 sat_per_vbyte = 6;
}
message CloseStatusUpdate {
@ -1460,6 +1772,10 @@ message ReadyForPsbtFunding {
}
message OpenChannelRequest {
// A manual fee rate set in sat/vbyte that should be used when crafting the
// funding transaction.
uint64 sat_per_vbyte = 1;
/*
The pubkey of the node to open a channel with. When using REST, this field
must be encoded as base64.
@ -1483,9 +1799,10 @@ message OpenChannelRequest {
// confirmed by.
int32 target_conf = 6;
// A manual fee rate set in sat/byte that should be used when crafting the
// Deprecated, use sat_per_vbyte.
// A manual fee rate set in sat/vbyte that should be used when crafting the
// funding transaction.
int64 sat_per_byte = 7;
int64 sat_per_byte = 7 [deprecated = true];
// Whether this channel should be private, not announced to the greater
// network.
@ -1527,6 +1844,24 @@ message OpenChannelRequest {
carried out in an interactive manner (PSBT based).
*/
FundingShim funding_shim = 14;
/*
The maximum amount of coins in millisatoshi that can be pending within
the channel. It only applies to the remote party.
*/
uint64 remote_max_value_in_flight_msat = 15;
/*
The maximum number of concurrent HTLCs we will allow the remote party to add
to the commitment transaction.
*/
uint32 remote_max_htlcs = 16;
/*
Max local csv is the maximum csv delay we will allow for our own commitment
transaction.
*/
uint32 max_local_csv = 17;
}
message OpenStatusUpdate {
oneof update {
@ -1601,10 +1936,11 @@ message ChanPointShim {
bytes pending_chan_id = 5;
/*
This uint32 indicates if this channel is to be considered 'frozen'. A
frozen channel does not allow a cooperative channel close by the
initiator. The thaw_height is the height that this restriction stops
applying to the channel.
This uint32 indicates if this channel is to be considered 'frozen'. A frozen
channel does not allow a cooperative channel close by the initiator. The
thaw_height is the height that this restriction stops applying to the
channel. The height can be interpreted in two ways: as a relative height if
the value is less than 500,000, or as an absolute height otherwise.
*/
uint32 thaw_height = 6;
}
@ -1622,6 +1958,16 @@ message PsbtShim {
non-empty, it must be a binary serialized PSBT.
*/
bytes base_psbt = 2;
/*
If a channel should be part of a batch (multiple channel openings in one
transaction), it can be dangerous if the whole batch transaction is
published too early before all channel opening negotiations are completed.
This flag prevents this particular channel from broadcasting the transaction
after the negotiation with the remote peer. In a batch of channel openings
this flag should be set to true for every channel but the very last.
*/
bool no_publish = 3;
}
message FundingShim {
@ -1661,12 +2007,19 @@ message FundingPsbtFinalize {
/*
The funded PSBT that contains all witness data to send the exact channel
capacity amount to the PK script returned in the open channel message in a
previous step.
previous step. Cannot be set at the same time as final_raw_tx.
*/
bytes signed_psbt = 1;
// The pending channel ID of the channel to get the PSBT for.
bytes pending_chan_id = 2;
/*
As an alternative to the signed PSBT with all witness data, the final raw
wire format transaction can also be specified directly. Cannot be set at the
same time as signed_psbt.
*/
bytes final_raw_tx = 3;
}
message FundingTransitionMsg {
@ -1909,8 +2262,17 @@ message ChannelEventUpdate {
UpdateType type = 5;
}
message WalletAccountBalance {
// The confirmed balance of the account (with >= 1 confirmations).
int64 confirmed_balance = 1;
// The unconfirmed balance of the account (with 0 confirmations).
int64 unconfirmed_balance = 2;
}
message WalletBalanceRequest {
}
message WalletBalanceResponse {
// The balance of the wallet
int64 total_balance = 1;
@ -1920,16 +2282,45 @@ message WalletBalanceResponse {
// The unconfirmed balance of a wallet(with 0 confirmations)
int64 unconfirmed_balance = 3;
// A mapping of each wallet account's name to its balance.
map<string, WalletAccountBalance> account_balance = 4;
}
message Amount {
// Value denominated in satoshis.
uint64 sat = 1;
// Value denominated in milli-satoshis.
uint64 msat = 2;
}
message ChannelBalanceRequest {
}
message ChannelBalanceResponse {
// Sum of channels balances denominated in satoshis
int64 balance = 1;
// Deprecated. Sum of channels balances denominated in satoshis
int64 balance = 1 [deprecated = true];
// Sum of channels pending balances denominated in satoshis
int64 pending_open_balance = 2;
// Deprecated. Sum of channels pending balances denominated in satoshis
int64 pending_open_balance = 2 [deprecated = true];
// Sum of channels local balances.
Amount local_balance = 3;
// Sum of channels remote balances.
Amount remote_balance = 4;
// Sum of channels local unsettled balances.
Amount unsettled_local_balance = 5;
// Sum of channels remote unsettled balances.
Amount unsettled_remote_balance = 6;
// Sum of channels pending local balances.
Amount pending_open_local_balance = 7;
// Sum of channels pending remote balances.
Amount pending_open_remote_balance = 8;
}
message QueryRoutesRequest {
@ -2088,7 +2479,7 @@ message Hop {
output index for the channel.
*/
uint64 chan_id = 1 [jstype = JS_STRING];
int64 chan_capacity = 2;
int64 chan_capacity = 2 [deprecated = true];
int64 amt_to_forward = 3 [deprecated = true];
int64 fee = 4 [deprecated = true];
uint32 expiry = 5;
@ -2110,12 +2501,22 @@ message Hop {
/*
An optional TLV record that signals the use of an MPP payment. If present,
the receiver will enforce that that the same mpp_record is included in the
final hop payload of all non-zero payments in the HTLC set. If empty, a
regular single-shot payment is or was attempted.
the receiver will enforce that the same mpp_record is included in the final
hop payload of all non-zero payments in the HTLC set. If empty, a regular
single-shot payment is or was attempted.
*/
MPPRecord mpp_record = 10;
/*
An optional TLV record that signals the use of an AMP payment. If present,
the receiver will treat all received payments including the same
(payment_addr, set_id) pair as being part of one logical payment. The
payment will be settled by XORing the root_share's together and deriving the
child hashes and preimages according to BOLT XX. Must be used in conjunction
with mpp_record.
*/
AMPRecord amp_record = 12;
/*
An optional set of key-value TLV records. This is useful within the context
of the SendToRoute call as it allows callers to specify arbitrary K-V pairs
@ -2142,6 +2543,14 @@ message MPPRecord {
int64 total_amt_msat = 10;
}
message AMPRecord {
bytes root_share = 1;
bytes set_id = 2;
uint32 child_index = 3;
}
/*
A path through the channel graph which runs over one or more channels in
succession. This struct carries all the information required to craft the
@ -2367,11 +2776,27 @@ message GraphTopologyUpdate {
repeated ClosedChannelUpdate closed_chans = 3;
}
message NodeUpdate {
repeated string addresses = 1;
/*
Deprecated, use node_addresses.
*/
repeated string addresses = 1 [deprecated = true];
string identity_key = 2;
bytes global_features = 3;
/*
Deprecated, use features.
*/
bytes global_features = 3 [deprecated = true];
string alias = 4;
string color = 5;
repeated NodeAddress node_addresses = 7;
/*
Features that the node has advertised in the init message, node
announcements and invoices.
*/
map<uint32, Feature> features = 6;
}
message ChannelEdgeUpdate {
/*
@ -2572,6 +2997,18 @@ message Invoice {
[EXPERIMENTAL].
*/
bool is_keysend = 25;
/*
The payment address of this invoice. This value will be used in MPP
payments, and also for newer invoies that always require the MPP paylaod
for added end-to-end security.
*/
bytes payment_addr = 26;
/*
Signals whether or not this is an AMP invoice.
*/
bool is_amp = 27;
}
enum InvoiceHTLCState {
@ -2611,6 +3048,31 @@ message InvoiceHTLC {
// The total amount of the mpp payment in msat.
uint64 mpp_total_amt_msat = 10;
// Details relevant to AMP HTLCs, only populated if this is an AMP HTLC.
AMP amp = 11;
}
// Details specific to AMP HTLCs.
message AMP {
// An n-of-n secret share of the root seed from which child payment hashes
// and preimages are derived.
bytes root_share = 1;
// An identifier for the HTLC set that this HTLC belongs to.
bytes set_id = 2;
// A nonce used to randomize the child preimage and child hash from a given
// root_share.
uint32 child_index = 3;
// The payment hash of the AMP HTLC.
bytes hash = 4;
// The preimage used to settle this AMP htlc. This field will only be
// populated if the invoice is in InvoiceState_ACCEPTED or
// InvoiceState_SETTLED.
bytes preimage = 5;
}
message AddInvoiceResponse {
@ -2630,6 +3092,13 @@ message AddInvoiceResponse {
invoices with an add_index greater than this one.
*/
uint64 add_index = 16;
/*
The payment address of the generated invoice. This value should be used
in all payments for this invoice as we require it for end to end
security.
*/
bytes payment_addr = 17;
}
message PaymentHash {
/*
@ -2801,6 +3270,9 @@ message Payment {
}
message HTLCAttempt {
// The unique ID that is used for this attempt.
uint64 attempt_id = 7;
enum HTLCStatus {
IN_FLIGHT = 0;
SUCCEEDED = 1;
@ -2876,6 +3348,13 @@ message ListPaymentsResponse {
}
message DeleteAllPaymentsRequest {
// Only delete failed payments.
bool failed_payments_only = 1;
/*
Only delete failed HTLCs from payments, not the payment itself.
*/
bool failed_htlcs_only = 2;
}
message DeleteAllPaymentsResponse {
@ -2883,6 +3362,8 @@ message DeleteAllPaymentsResponse {
message AbandonChannelRequest {
ChannelPoint channel_point = 1;
bool pending_funding_shim_only = 2;
}
message AbandonChannelResponse {
@ -2934,6 +3415,14 @@ enum FeatureBit {
PAYMENT_ADDR_OPT = 15;
MPP_REQ = 16;
MPP_OPT = 17;
WUMBO_CHANNELS_REQ = 18;
WUMBO_CHANNELS_OPT = 19;
ANCHORS_REQ = 20;
ANCHORS_OPT = 21;
ANCHORS_ZERO_FEE_HTLC_REQ = 22;
ANCHORS_ZERO_FEE_HTLC_OPT = 23;
AMP_REQ = 30;
AMP_OPT = 31;
}
message Feature {
@ -3034,8 +3523,8 @@ message ForwardingHistoryRequest {
}
message ForwardingEvent {
// Timestamp is the time (unix epoch offset) that this circuit was
// completed.
uint64 timestamp = 1;
// completed. Deprecated by timestamp_ns.
uint64 timestamp = 1 [deprecated = true];
// The incoming channel ID that carried the HTLC that created the circuit.
uint64 chan_id_in = 2 [jstype = JS_STRING];
@ -3066,6 +3555,10 @@ message ForwardingEvent {
// the second half of the circuit.
uint64 amt_out_msat = 10;
// The number of nanoseconds elapsed since January 1, 1970 UTC when this
// circuit was completed.
uint64 timestamp_ns = 11;
// TODO(roasbeef): add settlement latency?
// * use FPE on the chan id?
// * also list failures?
@ -3171,12 +3664,46 @@ message MacaroonPermission {
message BakeMacaroonRequest {
// The list of permissions the new macaroon should grant.
repeated MacaroonPermission permissions = 1;
// The root key ID used to create the macaroon, must be a positive integer.
uint64 root_key_id = 2;
}
message BakeMacaroonResponse {
// The hex encoded macaroon, serialized in binary format.
string macaroon = 1;
}
message ListMacaroonIDsRequest {
}
message ListMacaroonIDsResponse {
// The list of root key IDs that are in use.
repeated uint64 root_key_ids = 1;
}
message DeleteMacaroonIDRequest {
// The root key ID to be removed.
uint64 root_key_id = 1;
}
message DeleteMacaroonIDResponse {
// A boolean indicates that the deletion is successful.
bool deleted = 1;
}
message MacaroonPermissionList {
// A list of macaroon permissions.
repeated MacaroonPermission permissions = 1;
}
message ListPermissionsRequest {
}
message ListPermissionsResponse {
/*
A map between all RPC method URIs and their required macaroon permissions to
access them.
*/
map<string, MacaroonPermissionList> method_permissions = 1;
}
message Failure {
enum FailureCode {
/*
@ -3209,6 +3736,7 @@ message Failure {
PERMANENT_CHANNEL_FAILURE = 21;
EXPIRY_TOO_FAR = 22;
MPP_TIMEOUT = 23;
INVALID_ONION_PAYLOAD = 24;
/*
An internal error occurred.
@ -3339,3 +3867,14 @@ message ChannelUpdate {
*/
bytes extra_opaque_data = 12;
}
message MacaroonId {
bytes nonce = 1;
bytes storageId = 2;
repeated Op ops = 3;
}
message Op {
string entity = 1;
repeated string actions = 2;
}

File diff suppressed because it is too large Load diff

View file

@ -141,8 +141,24 @@ message InitWalletRequest {
recover the funds in each channel from a remote force closed transaction.
*/
ChanBackupSnapshot channel_backups = 5;
/*
stateless_init is an optional argument instructing the daemon NOT to create
any *.macaroon files in its filesystem. If this parameter is set, then the
admin macaroon returned in the response MUST be stored by the caller of the
RPC as otherwise all access to the daemon will be lost!
*/
bool stateless_init = 6;
}
message InitWalletResponse {
/*
The binary serialized admin macaroon that can be used to access the daemon
after creating the wallet. If the stateless_init parameter was set to true,
this is the ONLY copy of the macaroon and MUST be stored safely by the
caller. Otherwise a copy of this macaroon is also persisted on disk by the
daemon, together with other macaroon files.
*/
bytes admin_macaroon = 1;
}
message UnlockWalletRequest {
@ -171,6 +187,12 @@ message UnlockWalletRequest {
recover the funds in each channel from a remote force closed transaction.
*/
ChanBackupSnapshot channel_backups = 3;
/*
stateless_init is an optional argument instructing the daemon NOT to create
any *.macaroon files in its file system.
*/
bool stateless_init = 4;
}
message UnlockWalletResponse {
}
@ -187,6 +209,30 @@ message ChangePasswordRequest {
daemon. When using REST, this field must be encoded as base64.
*/
bytes new_password = 2;
/*
stateless_init is an optional argument instructing the daemon NOT to create
any *.macaroon files in its filesystem. If this parameter is set, then the
admin macaroon returned in the response MUST be stored by the caller of the
RPC as otherwise all access to the daemon will be lost!
*/
bool stateless_init = 3;
/*
new_macaroon_root_key is an optional argument instructing the daemon to
rotate the macaroon root key when set to true. This will invalidate all
previously generated macaroons.
*/
bool new_macaroon_root_key = 4;
}
message ChangePasswordResponse {
}
/*
The binary serialized admin macaroon that can be used to access the daemon
after rotating the macaroon root key. If both the stateless_init and
new_macaroon_root_key parameter were set to true, this is the ONLY copy of
the macaroon that was created from the new root key and MUST be stored
safely by the caller. Otherwise a copy of this macaroon is also persisted on
disk by the daemon, together with other macaroon files.
*/
bytes admin_macaroon = 1;
}

View file

@ -218,7 +218,11 @@ const server = program => {
await new Promise((resolve, reject) => {
LightningServices.services.lightning.getInfo({}, (err, res) => {
if (err && err.code !== 12) {
if (
err &&
!err.details.includes('wallet not created') &&
!err.details.includes('wallet locked')
) {
reject(err)
} else {
resolve()

View file

@ -50,7 +50,7 @@ class LNDErrorManager {
*/
const listener = (err, response) => {
if (err) {
if (err.code === 12) {
if (err.details.includes("wallet not created") || err.details.includes("wallet locked")) {
res({
service: 'walletUnlocker',
message: 'Wallet locked',