Merge branch 'master' into feature/api-caching
This commit is contained in:
commit
6fa65b9f2f
7 changed files with 3205 additions and 153 deletions
331
config/rpc.proto
331
config/rpc.proto
|
|
@ -1,5 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
|
import "google/api/annotations.proto";
|
||||||
|
|
||||||
package lnrpc;
|
package lnrpc;
|
||||||
|
|
||||||
|
|
@ -358,6 +359,13 @@ service Lightning {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
SubscribePeerEvents creates a uni-directional stream from the server to
|
||||||
|
the client in which any events relevant to the state of peers are sent
|
||||||
|
over. Events include peers going online and offline.
|
||||||
|
*/
|
||||||
|
rpc SubscribePeerEvents (PeerEventSubscription) returns (stream PeerEvent);
|
||||||
|
|
||||||
/** lncli: `getinfo`
|
/** lncli: `getinfo`
|
||||||
GetInfo returns general information concerning the lightning node including
|
GetInfo returns general information concerning the lightning node including
|
||||||
it's identity pubkey, alias, the chains it is connected to, and information
|
it's identity pubkey, alias, the chains it is connected to, and information
|
||||||
|
|
@ -429,10 +437,25 @@ service Lightning {
|
||||||
request to a remote peer. Users are able to specify a target number of
|
request to a remote peer. Users are able to specify a target number of
|
||||||
blocks that the funding transaction should be confirmed in, or a manual fee
|
blocks that the funding transaction should be confirmed in, or a manual fee
|
||||||
rate to us for the funding transaction. If neither are specified, then a
|
rate to us for the funding transaction. If neither are specified, then a
|
||||||
lax block confirmation target is used.
|
lax block confirmation target is used. Each OpenStatusUpdate will return
|
||||||
|
the pending channel ID of the in-progress channel. Depending on the
|
||||||
|
arguments specified in the OpenChannelRequest, this pending channel ID can
|
||||||
|
then be used to manually progress the channel funding flow.
|
||||||
*/
|
*/
|
||||||
rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate);
|
rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
FundingStateStep is an advanced funding related call that allows the caller
|
||||||
|
to either execute some preparatory steps for a funding workflow, or
|
||||||
|
manually progress a funding workflow. The primary way a funding flow is
|
||||||
|
identified is via its pending channel ID. As an example, this method can be
|
||||||
|
used to specify that we're expecting a funding flow for a particular
|
||||||
|
pending channel ID, for which we need to use specific parameters.
|
||||||
|
Alternatively, this can be used to interactively drive PSBT signing for
|
||||||
|
funding for partially complete funding transactions.
|
||||||
|
*/
|
||||||
|
rpc FundingStateStep(FundingTransitionMsg) returns (FundingStateStepResp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
ChannelAcceptor dispatches a bi-directional streaming RPC in which
|
ChannelAcceptor dispatches a bi-directional streaming RPC in which
|
||||||
OpenChannel requests are sent to the client and the client responds with
|
OpenChannel requests are sent to the client and the client responds with
|
||||||
|
|
@ -951,10 +974,23 @@ message SendRequest {
|
||||||
/**
|
/**
|
||||||
An optional field that can be used to pass an arbitrary set of TLV records
|
An optional field that can be used to pass an arbitrary set of TLV records
|
||||||
to a peer which understands the new records. This can be used to pass
|
to a peer which understands the new records. This can be used to pass
|
||||||
application specific data during the payment attempt. When using REST, the
|
application specific data during the payment attempt. Record types are
|
||||||
values must be encoded as base64.
|
required to be in the custom range >= 65536. When using REST, the values
|
||||||
|
must be encoded as base64.
|
||||||
*/
|
*/
|
||||||
map<uint64, bytes> dest_tlv = 11;
|
map<uint64, bytes> dest_custom_records = 11;
|
||||||
|
|
||||||
|
/// If set, circular payments to self are permitted.
|
||||||
|
bool allow_self_payment = 14;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Features assumed to be supported by the final node. All transitive feature
|
||||||
|
depdencies must also be set properly. For a given feature bit pair, either
|
||||||
|
optional or remote may be set, but not both. If this field is nil or empty,
|
||||||
|
the router will try to load destination features from the graph as a
|
||||||
|
fallback.
|
||||||
|
*/
|
||||||
|
repeated FeatureBit dest_features = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SendResponse {
|
message SendResponse {
|
||||||
|
|
@ -1332,6 +1368,15 @@ message Channel {
|
||||||
by the channel scoring system over the lifetime of the channel [EXPERIMENTAL].
|
by the channel scoring system over the lifetime of the channel [EXPERIMENTAL].
|
||||||
*/
|
*/
|
||||||
int64 uptime = 24 [json_name = "uptime"];
|
int64 uptime = 24 [json_name = "uptime"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
Close address is the address that we will enforce payout to on cooperative
|
||||||
|
close if the channel was opened utilizing option upfront shutdown. This
|
||||||
|
value can be set on channel open by setting close_address in an open channel
|
||||||
|
request. If this value is not set, you can still choose a payout address by
|
||||||
|
cooperatively closing with the delivery_address field set.
|
||||||
|
*/
|
||||||
|
string close_address = 25 [json_name ="close_address"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1444,6 +1489,9 @@ message Peer {
|
||||||
|
|
||||||
// The type of sync we are currently performing with this peer.
|
// The type of sync we are currently performing with this peer.
|
||||||
SyncType sync_type = 10 [json_name = "sync_type"];
|
SyncType sync_type = 10 [json_name = "sync_type"];
|
||||||
|
|
||||||
|
/// Features advertised by the remote peer in their init message.
|
||||||
|
map<uint32, Feature> features = 11 [json_name = "features"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListPeersRequest {
|
message ListPeersRequest {
|
||||||
|
|
@ -1453,22 +1501,46 @@ message ListPeersResponse {
|
||||||
repeated Peer peers = 1 [json_name = "peers"];
|
repeated Peer peers = 1 [json_name = "peers"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message PeerEventSubscription {
|
||||||
|
}
|
||||||
|
|
||||||
|
message PeerEvent {
|
||||||
|
/// The identity pubkey of the peer.
|
||||||
|
string pub_key = 1 [json_name = "pub_key"];
|
||||||
|
|
||||||
|
enum EventType {
|
||||||
|
PEER_ONLINE = 0;
|
||||||
|
PEER_OFFLINE = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventType type = 2 [ json_name = "type" ];
|
||||||
|
}
|
||||||
|
|
||||||
message GetInfoRequest {
|
message GetInfoRequest {
|
||||||
}
|
}
|
||||||
message GetInfoResponse {
|
message GetInfoResponse {
|
||||||
|
|
||||||
|
/// The version of the LND software that the node is running.
|
||||||
|
string version = 14 [ json_name = "version" ];
|
||||||
|
|
||||||
/// The identity pubkey of the current node.
|
/// The identity pubkey of the current node.
|
||||||
string identity_pubkey = 1 [json_name = "identity_pubkey"];
|
string identity_pubkey = 1 [json_name = "identity_pubkey"];
|
||||||
|
|
||||||
/// If applicable, the alias of the current node, e.g. "bob"
|
/// If applicable, the alias of the current node, e.g. "bob"
|
||||||
string alias = 2 [json_name = "alias"];
|
string alias = 2 [json_name = "alias"];
|
||||||
|
|
||||||
|
/// The color of the current node in hex code format
|
||||||
|
string color = 17 [json_name = "color"];
|
||||||
|
|
||||||
/// Number of pending channels
|
/// Number of pending channels
|
||||||
uint32 num_pending_channels = 3 [json_name = "num_pending_channels"];
|
uint32 num_pending_channels = 3 [json_name = "num_pending_channels"];
|
||||||
|
|
||||||
/// Number of active channels
|
/// Number of active channels
|
||||||
uint32 num_active_channels = 4 [json_name = "num_active_channels"];
|
uint32 num_active_channels = 4 [json_name = "num_active_channels"];
|
||||||
|
|
||||||
|
/// Number of inactive channels
|
||||||
|
uint32 num_inactive_channels = 15 [json_name = "num_inactive_channels"];
|
||||||
|
|
||||||
/// Number of peers
|
/// Number of peers
|
||||||
uint32 num_peers = 5 [json_name = "num_peers"];
|
uint32 num_peers = 5 [json_name = "num_peers"];
|
||||||
|
|
||||||
|
|
@ -1478,9 +1550,15 @@ message GetInfoResponse {
|
||||||
/// The node's current view of the hash of the best block
|
/// The node's current view of the hash of the best block
|
||||||
string block_hash = 8 [json_name = "block_hash"];
|
string block_hash = 8 [json_name = "block_hash"];
|
||||||
|
|
||||||
|
/// Timestamp of the block best known to the wallet
|
||||||
|
int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ];
|
||||||
|
|
||||||
/// Whether the wallet's view is synced to the main chain
|
/// Whether the wallet's view is synced to the main chain
|
||||||
bool synced_to_chain = 9 [json_name = "synced_to_chain"];
|
bool synced_to_chain = 9 [json_name = "synced_to_chain"];
|
||||||
|
|
||||||
|
// Whether we consider ourselves synced with the public channel graph.
|
||||||
|
bool synced_to_graph = 18 [json_name = "synced_to_graph"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Whether the current node is connected to testnet. This field is
|
Whether the current node is connected to testnet. This field is
|
||||||
deprecated and the network field should be used instead
|
deprecated and the network field should be used instead
|
||||||
|
|
@ -1489,26 +1567,17 @@ message GetInfoResponse {
|
||||||
|
|
||||||
reserved 11;
|
reserved 11;
|
||||||
|
|
||||||
/// The URIs of the current node.
|
|
||||||
repeated string uris = 12 [json_name = "uris"];
|
|
||||||
|
|
||||||
/// Timestamp of the block best known to the wallet
|
|
||||||
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" ];
|
|
||||||
|
|
||||||
/// Number of inactive channels
|
|
||||||
uint32 num_inactive_channels = 15 [json_name = "num_inactive_channels"];
|
|
||||||
|
|
||||||
/// A list of active chains the node is connected to
|
/// A list of active chains the node is connected to
|
||||||
repeated Chain chains = 16 [json_name = "chains"];
|
repeated Chain chains = 16 [json_name = "chains"];
|
||||||
|
|
||||||
/// The color of the current node in hex code format
|
/// The URIs of the current node.
|
||||||
string color = 17 [json_name = "color"];
|
repeated string uris = 12 [json_name = "uris"];
|
||||||
|
|
||||||
// Whether we consider ourselves synced with the public channel graph.
|
/*
|
||||||
bool synced_to_graph = 18 [json_name = "synced_to_graph"];
|
Features that our node has advertised in our init message, node
|
||||||
|
announcements and invoices.
|
||||||
|
*/
|
||||||
|
map<uint32, Feature> features = 19 [json_name = "features"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message Chain {
|
message Chain {
|
||||||
|
|
@ -1552,6 +1621,14 @@ message CloseChannelRequest {
|
||||||
|
|
||||||
/// 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 closure transaction.
|
||||||
int64 sat_per_byte = 4;
|
int64 sat_per_byte = 4;
|
||||||
|
|
||||||
|
/*
|
||||||
|
An optional address to send funds to in the case of a cooperative close.
|
||||||
|
If the channel was opened with an upfront shutdown script and this field
|
||||||
|
is set, the request to close will fail because the channel must pay out
|
||||||
|
to the upfront shutdown addresss.
|
||||||
|
*/
|
||||||
|
string delivery_address = 5 [json_name = "delivery_address"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message CloseStatusUpdate {
|
message CloseStatusUpdate {
|
||||||
|
|
@ -1605,14 +1682,114 @@ message OpenChannelRequest {
|
||||||
|
|
||||||
/// Whether unconfirmed outputs should be used as inputs for the funding transaction.
|
/// Whether unconfirmed outputs should be used as inputs for the funding transaction.
|
||||||
bool spend_unconfirmed = 12 [json_name = "spend_unconfirmed"];
|
bool spend_unconfirmed = 12 [json_name = "spend_unconfirmed"];
|
||||||
|
|
||||||
|
/*
|
||||||
|
Close address is an optional address which specifies the address to which
|
||||||
|
funds should be paid out to upon cooperative close. This field may only be
|
||||||
|
set if the peer supports the option upfront feature bit (call listpeers
|
||||||
|
to check). The remote peer will only accept cooperative closes to this
|
||||||
|
address if it is set.
|
||||||
|
|
||||||
|
Note: If this value is set on channel creation, you will *not* be able to
|
||||||
|
cooperatively close out to a different address.
|
||||||
|
*/
|
||||||
|
string close_address = 13 [json_name = "close_address"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
Funding shims are an optional argument that allow the caller to intercept
|
||||||
|
certain funding functionality. For example, a shim can be provided to use a
|
||||||
|
particular key for the commitment key (ideally cold) rather than use one
|
||||||
|
that is generated by the wallet as normal, or signal that signing will be
|
||||||
|
carried out in an interactive manner (PSBT based).
|
||||||
|
*/
|
||||||
|
FundingShim funding_shim = 14 [json_name = "funding_shim"];
|
||||||
}
|
}
|
||||||
message OpenStatusUpdate {
|
message OpenStatusUpdate {
|
||||||
oneof update {
|
oneof update {
|
||||||
PendingUpdate chan_pending = 1 [json_name = "chan_pending"];
|
PendingUpdate chan_pending = 1 [json_name = "chan_pending"];
|
||||||
ChannelOpenUpdate chan_open = 3 [json_name = "chan_open"];
|
ChannelOpenUpdate chan_open = 3 [json_name = "chan_open"];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The pending channel ID of the created channel. This value may be used to
|
||||||
|
further the funding flow manually via the FundingStateStep method.
|
||||||
|
*/
|
||||||
|
bytes pending_chan_id = 4 [json_name = "pending_chan_id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message KeyLocator {
|
||||||
|
/// The family of key being identified.
|
||||||
|
int32 key_family = 1;
|
||||||
|
|
||||||
|
/// The precise index of the key being identified.
|
||||||
|
int32 key_index = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message KeyDescriptor {
|
||||||
|
/**
|
||||||
|
The raw bytes of the key being identified.
|
||||||
|
*/
|
||||||
|
bytes raw_key_bytes = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The key locator that identifies which key to use for signing.
|
||||||
|
*/
|
||||||
|
KeyLocator key_loc = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChanPointShim {
|
||||||
|
/**
|
||||||
|
The size of the pre-crafted output to be used as the channel point for this
|
||||||
|
channel funding.
|
||||||
|
*/
|
||||||
|
int64 amt = 1;
|
||||||
|
|
||||||
|
/// The target channel point to refrence in created commitment transactions.
|
||||||
|
ChannelPoint chan_point = 2;
|
||||||
|
|
||||||
|
/// Our local key to use when creating the multi-sig output.
|
||||||
|
KeyDescriptor local_key = 3;
|
||||||
|
|
||||||
|
/// The key of the remote party to use when creating the multi-sig output.
|
||||||
|
bytes remote_key = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
If non-zero, then this will be used as the pending channel ID on the wire
|
||||||
|
protocol to initate the funding request. This is an optional field, and
|
||||||
|
should only be set if the responder is already expecting a specific pending
|
||||||
|
channel ID.
|
||||||
|
*/
|
||||||
|
bytes pending_chan_id = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FundingShim {
|
||||||
|
oneof shim {
|
||||||
|
ChanPointShim chan_point_shim = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message FundingShimCancel {
|
||||||
|
/// The pending channel ID of the channel to cancel the funding shim for.
|
||||||
|
bytes pending_chan_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FundingTransitionMsg {
|
||||||
|
oneof trigger {
|
||||||
|
/**
|
||||||
|
The funding shim to regsiter. This should be used before any
|
||||||
|
channel funding has began by the remote party, as it is intended as a
|
||||||
|
prepatory step for the full channel funding.
|
||||||
|
*/
|
||||||
|
FundingShim shim_register = 1;
|
||||||
|
|
||||||
|
/// Used to cancel an existing registered funding shim.
|
||||||
|
FundingShimCancel shim_cancel = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message FundingStateStepResp {
|
||||||
|
}
|
||||||
|
|
||||||
message PendingHTLC {
|
message PendingHTLC {
|
||||||
|
|
||||||
/// The direction within the channel that the htlc was sent
|
/// The direction within the channel that the htlc was sent
|
||||||
|
|
@ -1808,7 +1985,13 @@ message QueryRoutesRequest {
|
||||||
|
|
||||||
reserved 3;
|
reserved 3;
|
||||||
|
|
||||||
/// An optional CLTV delta from the current height that should be used for the timelock of the final hop
|
/**
|
||||||
|
An optional CLTV delta from the current height that should be used for the
|
||||||
|
timelock of the final hop. Note that unlike SendPayment, QueryRoutes does
|
||||||
|
not add any additional block padding on top of final_ctlv_delta. This
|
||||||
|
padding of a few blocks needs to be added manually or otherwise failures may
|
||||||
|
happen when a block comes in while the payment is in flight.
|
||||||
|
*/
|
||||||
int32 final_cltv_delta = 4;
|
int32 final_cltv_delta = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1853,6 +2036,41 @@ message QueryRoutesRequest {
|
||||||
zero, then the value of `--max-cltv-expiry` is used as the limit.
|
zero, then the value of `--max-cltv-expiry` is used as the limit.
|
||||||
*/
|
*/
|
||||||
uint32 cltv_limit = 11;
|
uint32 cltv_limit = 11;
|
||||||
|
|
||||||
|
/**
|
||||||
|
An optional field that can be used to pass an arbitrary set of TLV records
|
||||||
|
to a peer which understands the new records. This can be used to pass
|
||||||
|
application specific data during the payment attempt. If the destination
|
||||||
|
does not support the specified recrods, and error will be returned.
|
||||||
|
Record types are required to be in the custom range >= 65536. When using
|
||||||
|
REST, the values must be encoded as base64.
|
||||||
|
*/
|
||||||
|
map<uint64, bytes> dest_custom_records = 13;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The channel id of the channel that must be taken to the first hop. If zero,
|
||||||
|
any channel may be used.
|
||||||
|
*/
|
||||||
|
uint64 outgoing_chan_id = 14 [jstype = JS_STRING];
|
||||||
|
|
||||||
|
/**
|
||||||
|
The pubkey of the last hop of the route. If empty, any hop may be used.
|
||||||
|
*/
|
||||||
|
bytes last_hop_pubkey = 15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Optional route hints to reach the destination through private channels.
|
||||||
|
*/
|
||||||
|
repeated lnrpc.RouteHint route_hints = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Features assumed to be supported by the final node. All transitive feature
|
||||||
|
depdencies must also be set properly. For a given feature bit pair, either
|
||||||
|
optional or remote may be set, but not both. If this field is nil or empty,
|
||||||
|
the router will try to load destination features from the graph as a
|
||||||
|
fallback.
|
||||||
|
*/
|
||||||
|
repeated lnrpc.FeatureBit dest_features = 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NodePair {
|
message NodePair {
|
||||||
|
|
@ -1918,7 +2136,8 @@ message Hop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If set to true, then this hop will be encoded using the new variable length
|
If set to true, then this hop will be encoded using the new variable length
|
||||||
TLV format.
|
TLV format. Note that if any custom tlv_records below are specified, then
|
||||||
|
this field MUST be set to true for them to be encoded properly.
|
||||||
*/
|
*/
|
||||||
bool tlv_payload = 9 [json_name = "tlv_payload"];
|
bool tlv_payload = 9 [json_name = "tlv_payload"];
|
||||||
|
|
||||||
|
|
@ -1929,6 +2148,13 @@ message Hop {
|
||||||
regular single-shot payment is or was attempted.
|
regular single-shot payment is or was attempted.
|
||||||
*/
|
*/
|
||||||
MPPRecord mpp_record = 10 [json_name = "mpp_record"];
|
MPPRecord mpp_record = 10 [json_name = "mpp_record"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
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
|
||||||
|
to drop off at each hop within the onion.
|
||||||
|
*/
|
||||||
|
map<uint64, bytes> custom_records = 11 [json_name = "custom_records"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message MPPRecord {
|
message MPPRecord {
|
||||||
|
|
@ -2038,6 +2264,7 @@ message LightningNode {
|
||||||
string alias = 3 [ json_name = "alias" ];
|
string alias = 3 [ json_name = "alias" ];
|
||||||
repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
|
repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
|
||||||
string color = 5 [ json_name = "color" ];
|
string color = 5 [ json_name = "color" ];
|
||||||
|
map<uint32, Feature> features = 6 [ json_name = "features" ];
|
||||||
}
|
}
|
||||||
|
|
||||||
message NodeAddress {
|
message NodeAddress {
|
||||||
|
|
@ -2216,10 +2443,7 @@ message Invoice {
|
||||||
*/
|
*/
|
||||||
string memo = 1 [json_name = "memo"];
|
string memo = 1 [json_name = "memo"];
|
||||||
|
|
||||||
/** Deprecated. An optional cryptographic receipt of payment which is not
|
reserved 2;
|
||||||
implemented.
|
|
||||||
*/
|
|
||||||
bytes receipt = 2 [json_name = "receipt", deprecated = true];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The hex-encoded preimage (32 byte) which will allow settling an incoming
|
The hex-encoded preimage (32 byte) which will allow settling an incoming
|
||||||
|
|
@ -2343,6 +2567,15 @@ message Invoice {
|
||||||
|
|
||||||
/// List of HTLCs paying to this invoice [EXPERIMENTAL].
|
/// List of HTLCs paying to this invoice [EXPERIMENTAL].
|
||||||
repeated InvoiceHTLC htlcs = 22 [json_name = "htlcs"];
|
repeated InvoiceHTLC htlcs = 22 [json_name = "htlcs"];
|
||||||
|
|
||||||
|
/// List of features advertised on the invoice.
|
||||||
|
map<uint32, Feature> features = 24 [json_name = "features"];
|
||||||
|
|
||||||
|
/**
|
||||||
|
Indicates if this invoice was a spontaneous payment that arrived via keysend
|
||||||
|
[EXPERIMENTAL].
|
||||||
|
*/
|
||||||
|
bool is_keysend = 25 [json_name = "is_keysend"];
|
||||||
}
|
}
|
||||||
|
|
||||||
enum InvoiceHTLCState {
|
enum InvoiceHTLCState {
|
||||||
|
|
@ -2376,6 +2609,12 @@ message InvoiceHTLC {
|
||||||
|
|
||||||
/// Current state the htlc is in.
|
/// Current state the htlc is in.
|
||||||
InvoiceHTLCState state = 8 [json_name = "state"];
|
InvoiceHTLCState state = 8 [json_name = "state"];
|
||||||
|
|
||||||
|
/// Custom tlv records.
|
||||||
|
map<uint64, bytes> custom_records = 9 [json_name = "custom_records"];
|
||||||
|
|
||||||
|
/// The total amount of the mpp payment in msat.
|
||||||
|
uint64 mpp_total_amt_msat = 10 [json_name = "mpp_total_amt_msat"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddInvoiceResponse {
|
message AddInvoiceResponse {
|
||||||
|
|
@ -2413,7 +2652,10 @@ message PaymentHash {
|
||||||
}
|
}
|
||||||
|
|
||||||
message ListInvoiceRequest {
|
message ListInvoiceRequest {
|
||||||
/// If set, only unsettled invoices will be returned in the response.
|
/**
|
||||||
|
If set, only invoices that are not settled and not canceled will be returned
|
||||||
|
in the response.
|
||||||
|
*/
|
||||||
bool pending_only = 1 [json_name = "pending_only"];
|
bool pending_only = 1 [json_name = "pending_only"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2595,6 +2837,35 @@ message PayReq {
|
||||||
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"];
|
repeated RouteHint route_hints = 10 [json_name = "route_hints"];
|
||||||
|
bytes payment_addr = 11 [json_name = "payment_addr"];
|
||||||
|
int64 num_msat = 12 [json_name = "num_msat"];
|
||||||
|
map<uint32, Feature> features = 13 [json_name = "features"];
|
||||||
|
}
|
||||||
|
|
||||||
|
enum FeatureBit {
|
||||||
|
DATALOSS_PROTECT_REQ = 0;
|
||||||
|
DATALOSS_PROTECT_OPT = 1;
|
||||||
|
INITIAL_ROUING_SYNC = 3;
|
||||||
|
UPFRONT_SHUTDOWN_SCRIPT_REQ = 4;
|
||||||
|
UPFRONT_SHUTDOWN_SCRIPT_OPT = 5;
|
||||||
|
GOSSIP_QUERIES_REQ = 6;
|
||||||
|
GOSSIP_QUERIES_OPT = 7;
|
||||||
|
TLV_ONION_REQ = 8;
|
||||||
|
TLV_ONION_OPT = 9;
|
||||||
|
EXT_GOSSIP_QUERIES_REQ = 10;
|
||||||
|
EXT_GOSSIP_QUERIES_OPT = 11;
|
||||||
|
STATIC_REMOTE_KEY_REQ = 12;
|
||||||
|
STATIC_REMOTE_KEY_OPT = 13;
|
||||||
|
PAYMENT_ADDR_REQ = 14;
|
||||||
|
PAYMENT_ADDR_OPT = 15;
|
||||||
|
MPP_REQ = 16;
|
||||||
|
MPP_OPT = 17;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Feature {
|
||||||
|
string name = 2 [json_name = "name"];
|
||||||
|
bool is_required = 3 [json_name = "is_required"];
|
||||||
|
bool is_known = 4 [json_name = "is_known"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message FeeReportRequest {}
|
message FeeReportRequest {}
|
||||||
|
|
@ -2645,6 +2916,12 @@ message PolicyUpdateRequest {
|
||||||
|
|
||||||
/// If set, the maximum HTLC size in milli-satoshis. If unset, the maximum HTLC will be unchanged.
|
/// If set, the maximum HTLC size in milli-satoshis. If unset, the maximum HTLC will be unchanged.
|
||||||
uint64 max_htlc_msat = 6 [json_name = "max_htlc_msat"];
|
uint64 max_htlc_msat = 6 [json_name = "max_htlc_msat"];
|
||||||
|
|
||||||
|
/// The minimum HTLC size in milli-satoshis. Only applied if min_htlc_msat_specified is true.
|
||||||
|
uint64 min_htlc_msat = 7 [json_name = "min_htlc_msat"];
|
||||||
|
|
||||||
|
/// If true, min_htlc_msat is applied.
|
||||||
|
bool min_htlc_msat_specified = 8 [json_name = "set_min_htlc_msat"];
|
||||||
}
|
}
|
||||||
message PolicyUpdateResponse {
|
message PolicyUpdateResponse {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2798
config/rpc.proto.old
Normal file
2798
config/rpc.proto.old
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,8 @@
|
||||||
"main": "src/server.js",
|
"main": "src/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node --experimental-modules src/server.js",
|
"start": "node --experimental-modules src/server.js",
|
||||||
"dev": "node --max-old-space-size=4096 main.js -h 0.0.0.0",
|
"dev": "node --trace-warnings --max-old-space-size=4096 main.js -h 0.0.0.0",
|
||||||
|
"dev": "node main.js -h 0.0.0.0",
|
||||||
"dev:watch": "nodemon main.js -- -h 0.0.0.0",
|
"dev:watch": "nodemon main.js -- -h 0.0.0.0",
|
||||||
"test": "jest --no-cache",
|
"test": "jest --no-cache",
|
||||||
"test:watch": "jest --no-cache --watch",
|
"test:watch": "jest --no-cache --watch",
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1 @@
|
||||||
{
|
{}
|
||||||
"1582813836485": "b8328f50-596d-11ea-b251-cf923e62abf5",
|
|
||||||
"1582815195785": "e2674790-5970-11ea-ba5d-4b7fda6488de",
|
|
||||||
"1582820933939": "3e9c1830-597e-11ea-acaa-2b96f5467d08",
|
|
||||||
"1582670203354": "4c2e13a0-581f-11ea-ad3d-a73b4b4c0361",
|
|
||||||
"1583339145556": "cccda140-5e34-11ea-8c4e-17a1f5fd1235",
|
|
||||||
"1583584195969": "5a3b3f10-606f-11ea-8523-9d59c298ff41",
|
|
||||||
"1583584284436": "8ef63d40-606f-11ea-ba0f-e74d20a4ef9a",
|
|
||||||
"1583584328860": "a970cdc0-606f-11ea-ba0f-e74d20a4ef9a",
|
|
||||||
"1583584658911": "6e2a96f0-6070-11ea-ba0f-e74d20a4ef9a",
|
|
||||||
"1583585004260": "3c02aa40-6071-11ea-987e-bd3595c9104b",
|
|
||||||
"1583585179728": "a498f500-6071-11ea-a5f5-1f051c0be7de",
|
|
||||||
"1583585675201": "cbec2310-6072-11ea-a5f5-1f051c0be7de",
|
|
||||||
"1583585744767": "f56310f0-6072-11ea-a5f5-1f051c0be7de",
|
|
||||||
"1583585838554": "2d49d3a0-6073-11ea-b4d0-f9a792ba6160",
|
|
||||||
"1583586016626": "976d7520-6073-11ea-a6b4-4380ee6b86a1",
|
|
||||||
"1583588647390": "b77c2fe0-6079-11ea-a0aa-8368c2d33cfe",
|
|
||||||
"1583590307894": "9538fd60-607d-11ea-92cb-ed88e8db1271",
|
|
||||||
"1583590742693": "98623460-607e-11ea-bf6c-611b3b0363dc"
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@ const Encryption = require('../../../utils/encryptionStore')
|
||||||
/** @type {import('../contact-api/SimpleGUN').ISEA} */
|
/** @type {import('../contact-api/SimpleGUN').ISEA} */
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const SEAx = require('gun/sea')
|
const SEAx = require('gun/sea')
|
||||||
// @ts-ignore
|
// Re-enable in the future, when SEA errors inside user.auth/etc actually
|
||||||
SEAx.throw = true
|
// propagate up.
|
||||||
|
// SEAx.throw = true
|
||||||
|
|
||||||
/** @type {import('../contact-api/SimpleGUN').ISEA} */
|
/** @type {import('../contact-api/SimpleGUN').ISEA} */
|
||||||
const mySEA = {}
|
const mySEA = {}
|
||||||
|
|
@ -315,7 +316,10 @@ const authenticate = async (alias, pass, __user) => {
|
||||||
|
|
||||||
return ack.sea.pub
|
return ack.sea.pub
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unknown error.')
|
logger.error(
|
||||||
|
`Unknown error, wrong password? Ack looks like: ${JSON.stringify(ack)}`
|
||||||
|
)
|
||||||
|
throw new Error(`Didn't work, bad password?`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
189
src/routes.js
189
src/routes.js
|
|
@ -444,47 +444,6 @@ module.exports = async (
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/api/lnd/connect", (req, res) => {
|
|
||||||
const { lightning, walletUnlocker } = LightningServices.services;
|
|
||||||
const args = {
|
|
||||||
wallet_password: Buffer.from(req.body.password, "utf-8")
|
|
||||||
};
|
|
||||||
|
|
||||||
lightning.getInfo({}, async err => {
|
|
||||||
if (err) {
|
|
||||||
// try to unlock wallet
|
|
||||||
await recreateLnServices();
|
|
||||||
return walletUnlocker.unlockWallet(args, async unlockErr => {
|
|
||||||
if (unlockErr) {
|
|
||||||
unlockErr.error = unlockErr.message;
|
|
||||||
logger.error("Unlock Error:", unlockErr);
|
|
||||||
const health = await checkHealth();
|
|
||||||
if (health.LNDStatus.success) {
|
|
||||||
res.status(400);
|
|
||||||
res.json({ field: "WalletUnlocker", errorMessage: unlockErr.message });
|
|
||||||
} else {
|
|
||||||
res.status(500);
|
|
||||||
res.json({ errorMessage: "LND is down" });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await recreateLnServices();
|
|
||||||
mySocketsEvents.emit("updateLightning");
|
|
||||||
const token = await auth.generateToken();
|
|
||||||
res.json({
|
|
||||||
authorization: token
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const token = await auth.generateToken();
|
|
||||||
|
|
||||||
return res.json({
|
|
||||||
authorization: token
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post("/api/lnd/wallet", async (req, res) => {
|
app.post("/api/lnd/wallet", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { walletUnlocker } = LightningServices.services;
|
const { walletUnlocker } = LightningServices.services;
|
||||||
|
|
@ -641,66 +600,72 @@ module.exports = async (
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/api/lnd/wallet/existing", async (req, res) => {
|
app.post("/api/lnd/wallet/existing", async (req, res) => {
|
||||||
const { password, alias } = req.body;
|
|
||||||
const healthResponse = await checkHealth();
|
|
||||||
const exists = await walletExists();
|
|
||||||
if (!exists) {
|
|
||||||
return res.status(500).json({
|
|
||||||
field: "wallet",
|
|
||||||
errorMessage: "LND wallet does not exist, please create a new one"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!alias) {
|
|
||||||
return res.status(400).json({
|
|
||||||
field: "alias",
|
|
||||||
errorMessage: "Please specify an alias for your wallet"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!password) {
|
|
||||||
return res.status(400).json({
|
|
||||||
field: "password",
|
|
||||||
errorMessage: "Please specify a password for your wallet alias"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (password.length < 8) {
|
|
||||||
return res.status(400).json({
|
|
||||||
field: "password",
|
|
||||||
errorMessage: "Please specify a password that's longer than 8 characters"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (healthResponse.LNDStatus.service !== "walletUnlocker") {
|
|
||||||
return res.status(400).json({
|
|
||||||
field: "wallet",
|
|
||||||
errorMessage: "Wallet is already unlocked. Please restart your LND instance and try again."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await unlockWallet(password);
|
const { password, alias } = req.body;
|
||||||
} catch(err) {
|
const healthResponse = await checkHealth();
|
||||||
return res.status(401).json({
|
const exists = await walletExists();
|
||||||
field: "wallet",
|
if (!exists) {
|
||||||
errorMessage: "Invalid LND wallet password"
|
return res.status(500).json({
|
||||||
});
|
field: "wallet",
|
||||||
}
|
errorMessage: "LND wallet does not exist, please create a new one"
|
||||||
|
});
|
||||||
// Register user after verifying wallet password
|
|
||||||
const publicKey = await GunDB.register(alias, password);
|
|
||||||
|
|
||||||
// Generate Access Token
|
|
||||||
const token = await auth.generateToken();
|
|
||||||
|
|
||||||
res.json({
|
|
||||||
authorization: token,
|
|
||||||
user: {
|
|
||||||
alias,
|
|
||||||
publicKey
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
if (!alias) {
|
||||||
|
return res.status(400).json({
|
||||||
|
field: "alias",
|
||||||
|
errorMessage: "Please specify an alias for your wallet"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!password) {
|
||||||
|
return res.status(400).json({
|
||||||
|
field: "password",
|
||||||
|
errorMessage: "Please specify a password for your wallet alias"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (password.length < 8) {
|
||||||
|
return res.status(400).json({
|
||||||
|
field: "password",
|
||||||
|
errorMessage: "Please specify a password that's longer than 8 characters"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (healthResponse.LNDStatus.service !== "walletUnlocker") {
|
||||||
|
return res.status(400).json({
|
||||||
|
field: "wallet",
|
||||||
|
errorMessage: "Wallet is already unlocked. Please restart your LND instance and try again."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await unlockWallet(password);
|
||||||
|
} catch(err) {
|
||||||
|
return res.status(401).json({
|
||||||
|
field: "wallet",
|
||||||
|
errorMessage: "Invalid LND wallet password"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register user after verifying wallet password
|
||||||
|
const publicKey = await GunDB.register(alias, password);
|
||||||
|
|
||||||
|
// Generate Access Token
|
||||||
|
const token = await auth.generateToken();
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
authorization: token,
|
||||||
|
user: {
|
||||||
|
alias,
|
||||||
|
publicKey
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
return res.status(500).json({
|
||||||
|
errorMessage: err.message,
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// get lnd info
|
// get lnd info
|
||||||
|
|
@ -757,6 +722,32 @@ module.exports = async (
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
// get lnd chan info
|
||||||
|
app.post("/api/lnd/getchaninfo", (req, res) => {
|
||||||
|
const { lightning } = LightningServices.services;
|
||||||
|
|
||||||
|
lightning.getChanInfo(
|
||||||
|
{ chan_id: req.body.chan_id },
|
||||||
|
async (err, response) => {
|
||||||
|
if (err) {
|
||||||
|
logger.debug("GetChanInfo Error:", err);
|
||||||
|
const health = await checkHealth();
|
||||||
|
if (health.LNDStatus.success) {
|
||||||
|
res.status(400);
|
||||||
|
res.json({
|
||||||
|
field: "getChanInfo",
|
||||||
|
errorMessage: sanitizeLNDError(err.message)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
res.status(500);
|
||||||
|
res.json({ errorMessage: "LND is down" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.debug("GetChanInfo:", response);
|
||||||
|
res.json(response);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
app.get("/api/lnd/getnetworkinfo", (req, res) => {
|
app.get("/api/lnd/getnetworkinfo", (req, res) => {
|
||||||
const { lightning } = LightningServices.services;
|
const { lightning } = LightningServices.services;
|
||||||
|
|
|
||||||
|
|
@ -730,9 +730,9 @@ acorn-walk@^6.0.1:
|
||||||
integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==
|
integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==
|
||||||
|
|
||||||
acorn@^5.5.3:
|
acorn@^5.5.3:
|
||||||
version "5.7.3"
|
version "5.7.4"
|
||||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279"
|
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
|
||||||
integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==
|
integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==
|
||||||
|
|
||||||
acorn@^6.0.1:
|
acorn@^6.0.1:
|
||||||
version "6.3.0"
|
version "6.3.0"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue