Skip to content

Commit

Permalink
Merge pull request #61 from lightningj-org/support_lnd_0.12.0-rc2
Browse files Browse the repository at this point in the history
Fixes for support of lnd 0.12.0-rc2
  • Loading branch information
herrvendil authored Dec 20, 2020
2 parents 0dddfbf + 75913ea commit ba0df46
Show file tree
Hide file tree
Showing 12 changed files with 452 additions and 38 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group 'org.lightningj'

version '0.11.1-Beta'
version '0.12.0-Beta-rc2'

apply plugin: "groovy"
apply plugin: 'com.google.protobuf'
Expand Down
1 change: 1 addition & 0 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ to the license agreement can be found link:LICENSE.txt[here].

== Whats New

* 0.12.0-Beta-rc2: Generated against LND 0.12.0-rc1 API
* 0.11.1-Beta : Generated against LND 0.11.1 API
* 0.11.0-Beta : Generated against LND 0.11.0, WalletUnlocker API moved to package org.lightningj.lnd.wrapper.walletunlocker
and also separate XSD in order to match APIs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class LNDIntegrationSpec extends Specification{
when:
QueryRoutesRequest queryRoutesRequest = new QueryRoutesRequest();
//queryRoutesRequest.setSourcePubKey("03977f437e05f64b36fa973b415049e6c36c0163b0af097bab2eb3642501055efa")
queryRoutesRequest.setPubKey("02212d3ec887188b284dbb7b2e6eb40629a6e14fb049673f22d2a0aa05f902090e")
queryRoutesRequest.setPubKey("023a8dfe081c6bbd0504e599f33d39d17687de63023a8b20afcb59147d9d77c19d")
queryRoutesRequest.setAmt(1)

QueryRoutesResponse resp = synchronousLndAPI.queryRoutes(queryRoutesRequest)
Expand Down
204 changes: 195 additions & 9 deletions src/main/proto/lightning.api.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This file is fetched from https://github.com/lightningnetwork/lnd/blob/master/lnrpc/rpc.proto
* And is distributed under LNDs MIT License.
* LND (4d79861) tag : Downloaded 2020-09-21
* LND (98c61be) tag : Downloaded 2020-12-19
*/
syntax = "proto3";

Expand Down Expand Up @@ -38,8 +38,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);

Expand Down Expand Up @@ -500,6 +501,19 @@ service Lightning {
*/
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.
Expand Down Expand Up @@ -783,6 +797,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 {
Expand Down Expand Up @@ -855,6 +921,13 @@ message SendManyRequest {

// 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
Expand Down Expand Up @@ -885,6 +958,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
Expand Down Expand Up @@ -962,6 +1042,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 {
}
Expand All @@ -978,6 +1064,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 {
Expand Down Expand Up @@ -1408,6 +1509,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 {
Expand Down Expand Up @@ -1693,6 +1808,12 @@ message OpenChannelRequest {
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 {
Expand Down Expand Up @@ -2106,14 +2227,40 @@ message WalletBalanceResponse {
int64 unconfirmed_balance = 3;
}

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];

// 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 balances denominated in satoshis
int64 pending_open_balance = 2;
// Sum of channels pending remote balances.
Amount pending_open_remote_balance = 8;
}

message QueryRoutesRequest {
Expand Down Expand Up @@ -2553,9 +2700,15 @@ message GraphTopologyUpdate {
message NodeUpdate {
repeated string addresses = 1;
string identity_key = 2;
bytes global_features = 3;
bytes global_features = 3 [deprecated = true];
string alias = 4;
string color = 5;

/*
Features that the node has advertised in the init message, node
announcements and invoices.
*/
map<uint32, Feature> features = 6;
}
message ChannelEdgeUpdate {
/*
Expand Down Expand Up @@ -2756,6 +2909,13 @@ 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;
}

enum InvoiceHTLCState {
Expand Down Expand Up @@ -2814,6 +2974,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 {
/*
Expand Down Expand Up @@ -3357,12 +3524,31 @@ 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;
Expand Down Expand Up @@ -3550,4 +3736,4 @@ message MacaroonId {
message Op {
string entity = 1;
repeated string actions = 2;
}
}
10 changes: 8 additions & 2 deletions src/main/proto/router.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This file is fetched from https://github.com/lightningnetwork/lnd/blob/master/lnrpc/rpc.proto
* And is distributed under LNDs MIT License.
* LND (2903505) tag : Downloaded 2020-08-12
* LND (d996607) tag : Downloaded 2020-12-19
*/
syntax = "proto3";

Expand Down Expand Up @@ -400,6 +400,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 {
Expand Down Expand Up @@ -637,6 +640,9 @@ message ForwardHtlcInterceptRequest {

// 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;
}

/**
Expand Down Expand Up @@ -664,4 +670,4 @@ enum ResolveHoldForwardAction {
SETTLE = 0;
FAIL = 1;
RESUME = 2;
}
}
Loading

0 comments on commit ba0df46

Please sign in to comment.