Skip to content

Commit

Permalink
Merge pull request #58 from lightningj-org/support_lnd_0.11.0-rc2
Browse files Browse the repository at this point in the history
Added support for lnd 0.11
  • Loading branch information
herrvendil authored Sep 3, 2020
2 parents 8c7c640 + d80bf1f commit 8c3f2b2
Show file tree
Hide file tree
Showing 19 changed files with 1,778 additions and 1,469 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group 'org.lightningj'

version '0.10.1-Beta'
version '0.11.0-Beta'

apply plugin: "groovy"
apply plugin: 'com.google.protobuf'
Expand Down Expand Up @@ -117,7 +117,7 @@ compileJava {
*/
task generateWrappers(type: WrapperClassGenerator, dependsOn:compileJava){
// When adding new protocols, remember to also add in WrapperFactory.
protocols = ["lnrpc","autopilot","chainnotifier","invoices","router","signer","walletkit","watchtower","wtclient","verrpc"]
protocols = ["lnrpc","autopilot","chainnotifier","invoices","router","signer","walletkit","watchtower","wtclient","verrpc", "walletunlocker"]
}

/*
Expand All @@ -144,7 +144,7 @@ dependencies {

task generateXSD(type: XSDGenerator, dependsOn: compileWrapperMessages){
classpath=compileJava.classpath.asPath
protocols = ["lnrpc","autopilot","chainnotifier","invoices","router","signer","walletkit","watchtower","wtclient","verrpc"]
protocols = ["lnrpc","autopilot","chainnotifier","invoices","router","signer","walletkit","watchtower","wtclient","verrpc","walletunlocker"]
}

/*
Expand Down
32 changes: 22 additions & 10 deletions buildSrc/src/main/groovy/ProtocolSettings.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class ProtocolSettings extends BaseProtocolSettings{
return "org.lightningj.lnd.wtclient.proto.Wtclient"
case "verrpc":
return "org.lightningj.lnd.verrpc.proto.Verrpc"
case "walletunlocker":
return "org.lightningj.lnd.walletunlocker.proto.Walletunlocker"
}
}

Expand All @@ -62,6 +64,8 @@ import org.lightningj.lnd.wrapper.signer.message.TxOut;
import org.lightningj.lnd.wrapper.signer.message.KeyLocator;
import org.lightningj.lnd.wrapper.signer.message.KeyDescriptor;
import org.lightningj.lnd.signer.proto.SignerOuterClass;
import org.lightningj.lnd.wrapper.message.Utxo;
import org.lightningj.lnd.wrapper.message.TransactionDetails;
"""
case "router":
return """import org.lightningj.lnd.proto.LightningApi;
Expand All @@ -72,6 +76,10 @@ import org.lightningj.lnd.wrapper.message.FeatureBit;
import org.lightningj.lnd.wrapper.message.Failure;
import org.lightningj.lnd.wrapper.message.Failure.FailureCode;
import org.lightningj.lnd.wrapper.message.Payment;
"""
case "walletunlocker":
return """
import org.lightningj.lnd.wrapper.message.ChanBackupSnapshot;
"""
default:
return ""
Expand All @@ -89,14 +97,6 @@ import org.lightningj.lnd.wrapper.message.Payment;
baseProtoClassPath: 'org.lightningj.lnd.proto.LightningApi',
baseStubClass: 'Lightning',
baseFileName: 'LndAPI.java'
),
new ApiSettings(
baseGrpcClassPath:'org.lightningj.lnd.proto.WalletUnlockerGrpc$WalletUnlocker',
grpcClassName: 'WalletUnlockerGrpc',
baseApiClassName: 'WalletUnlockerAPI',
baseProtoClassPath: 'org.lightningj.lnd.proto.LightningApi',
baseStubClass: 'WalletUnlocker',
baseFileName: 'WalletUnlockerAPI.java'
)
]
case "autopilot":
Expand Down Expand Up @@ -198,6 +198,17 @@ import org.lightningj.lnd.wrapper.message.Payment;
baseFileName: 'VersionerAPI.java'
)
]
case "walletunlocker":
return [
new ApiSettings(
baseGrpcClassPath:'org.lightningj.lnd.walletunlocker.proto.WalletUnlockerGrpc$WalletUnlocker',
grpcClassName: 'WalletUnlockerGrpc',
baseApiClassName: 'WalletUnlockerAPI',
baseProtoClassPath: 'org.lightningj.lnd.walletunlocker.proto.Walletunlocker',
baseStubClass: 'WalletUnlocker',
baseFileName: 'WalletUnlockerAPI.java'
)
]
default:
return []
}
Expand Down Expand Up @@ -235,7 +246,7 @@ import org.lightningj.lnd.wrapper.message.Payment;
}
break
case "router":
if(methodName == "sendPaymentV2" || methodName == "trackPaymentV2"){
if(methodName == "sendPaymentV2" || methodName == "trackPaymentV2" || methodName == "sendToRouteV2"){
return "LightningApi"
}
}
Expand All @@ -257,7 +268,8 @@ import org.lightningj.lnd.wrapper.message.Payment;
@javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/walletkit_1_0", prefix = "walletkit"),
@javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/watchtower_1_0", prefix = "watchtower"),
@javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/wtclient_1_0", prefix = "wtclient"),
@javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/verrpc_1_0", prefix = "verrpc")
@javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/verrpc_1_0", prefix = "verrpc"),
@javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/walletunlocker_1_0", prefix = "walletunlocker")
"""
}

Expand Down
17 changes: 10 additions & 7 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ to the license agreement can be found link:LICENSE.txt[here].

== Whats New

* 0.10.1-Beta : Generated against LND 0.10.1 API. With updated Router GRPC 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
* 0.10.1-Beta : Generated against LND 0.10.1, 0.10.2, 0.10.3 API. With updated Router GRPC API.
* 0.10.1-Beta-rc1: Generated against LND 0.10.1-rc1 API. With updated Router GRPC API.
* 0.10.0-Beta : Generated against LND 0.10.0 API
* 0.10.0-Beta-rc2: Generated against LND 0.10.0 API-rc2. Added Versioner GRPC API.
Expand Down Expand Up @@ -320,9 +322,9 @@ Starting from 0.6.0 there are several different APIs to the different services.

| Wallet API
| Unlocking of Wallet
| org.lightningj.lnd.wrapper.SynchronousWalletUnlockerAPI
| org.lightningj.lnd.wrapper.AsynchronousWalletUnlockerAPI
| 0.1-Beta
| org.lightningj.lnd.wrapper.walletunlocker.SynchronousWalletUnlockerAPI
| org.lightningj.lnd.wrapper.walletunlocker.AsynchronousWalletUnlockerAPI
| 0.11-Beta

| Autopilot API
| Contains methods for managing autopilot
Expand Down Expand Up @@ -468,7 +470,8 @@ while(result.hasNext()){
----

In 0.6.0 was the schema updated and there exists several schemas for each separate service. See table
below for link to each schema, namespace and default prefix.
below for link to each schema, namespace and default prefix. in 0.11 is the walletunlocker API moved to its own
XSD.

.List of Available APIs
|===
Expand All @@ -484,8 +487,8 @@ below for link to each schema, namespace and default prefix.
| Wallet API
| Unlocking of Wallet
| None
| http://lightningj.org/xsd/lndjapi_1_0
| link:lnd_v1.xsd[lnd_v1.xsd]
| http://lightningj.org/xsd/http://lightningj.org/xsd/walletunlocker_1_0
| link:walletunlocker_v1.xsd[lnd_v1.xsd]
| 0.1-Beta

| Autopilot API
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/lightningj/lnd/wrapper/V1XMLParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ protected String[] getSchemaLocations() {
"/walletkit_v1.xsd",
"/watchtower_v1.xsd",
"/wtclient_v1.xsd",
"/verrpc_v1.xsd"
"/verrpc_v1.xsd",
"/walletunlocker_v1.xsd"
};
}

Expand All @@ -62,6 +63,7 @@ protected String getJAXBClassPath() {
"org.lightningj.lnd.wrapper.walletkit.message:" +
"org.lightningj.lnd.wrapper.watchtower.message:" +
"org.lightningj.lnd.wrapper.wtclient.message:" +
"org.lightningj.lnd.wrapper.verrpc.message";
"org.lightningj.lnd.wrapper.verrpc.message:" +
"org.lightningj.lnd.wrapper.walletunlocker.message";
}
}
20 changes: 10 additions & 10 deletions src/main/proto/autopilot.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 (bcfe92c) tag : Downloaded 2020-04-12
* LND (71c58c2) tag : Downloaded 2020-08-12
*/
syntax = "proto3";

Expand All @@ -14,25 +14,25 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc/autopilotrpc";
// state of the daemon's autopilot agent, and also supply it with information
// that can be used when deciding where to open channels.
service Autopilot {
/**
/*
Status returns whether the daemon's autopilot agent is active.
*/
rpc Status (StatusRequest) returns (StatusResponse);

/**
/*
ModifyStatus is used to modify the status of the autopilot agent, like
enabling or disabling it.
*/
rpc ModifyStatus (ModifyStatusRequest) returns (ModifyStatusResponse);

/**
/*
QueryScores queries all available autopilot heuristics, in addition to any
active combination of these heruristics, for the scores they would give to
the given nodes.
*/
rpc QueryScores (QueryScoresRequest) returns (QueryScoresResponse);

/**
/*
SetScores attempts to set the scores used by the running autopilot agent,
if the external scoring heuristic is enabled.
*/
Expand All @@ -43,12 +43,12 @@ message StatusRequest {
}

message StatusResponse {
/// Indicates whether the autopilot is active or not.
// Indicates whether the autopilot is active or not.
bool active = 1;
}

message ModifyStatusRequest {
/// Whether the autopilot agent should be enabled or not.
// Whether the autopilot agent should be enabled or not.
bool enable = 1;
}

Expand All @@ -58,7 +58,7 @@ message ModifyStatusResponse {
message QueryScoresRequest {
repeated string pubkeys = 1;

/// If set, we will ignore the local channel state when calculating scores.
// If set, we will ignore the local channel state when calculating scores.
bool ignore_local_state = 2;
}

Expand All @@ -72,10 +72,10 @@ message QueryScoresResponse {
}

message SetScoresRequest {
/// The name of the heuristic to provide scores to.
// The name of the heuristic to provide scores to.
string heuristic = 1;

/**
/*
A map from hex-encoded public keys to scores. Scores must be in the range
[0.0, 1.0].
*/
Expand Down
77 changes: 40 additions & 37 deletions src/main/proto/chain.notifier.proto
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
/**
* This file is fetched from https://github.com/lightningnetwork/lnd/blob/master/lnrpc/rpc.proto
* And is distributed under LNDs MIT License.
* LND (fdcb30e) tag : Downloaded 2020-04-12
* LND (0800386) tag : Downloaded 2020-08-12
*/
syntax = "proto3";

option java_package = "org.lightningj.lnd.chainnotifier.proto";

package chainrpc;

option java_package = "org.lightningj.lnd.chainnotifier.proto";
// ChainNotifier is a service that can be used to get information about the
// chain backend by registering notifiers for chain events.
service ChainNotifier {
/*
RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified once a confirmation request
has reached its required number of confirmations on-chain.
A client can specify whether the confirmation request should be for a
particular transaction by its hash or for an output script by specifying a
zero hash.
*/
rpc RegisterConfirmationsNtfn (ConfRequest) returns (stream ConfEvent);

/*
RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
intent for a client to be notification once a spend request has been spent
by a transaction that has confirmed on-chain.
A client can specify whether the spend request should be for a particular
outpoint or for an output script by specifying a zero outpoint.
*/
rpc RegisterSpendNtfn (SpendRequest) returns (stream SpendEvent);

/*
RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified of blocks in the chain. The
stream will return a hash and height tuple of a block for each new/stale
block in the chain. It is the client's responsibility to determine whether
the tuple returned is for a new or stale block in the chain.
A client can also request a historical backlog of blocks from a particular
point. This allows clients to be idempotent by ensuring that they do not
missing processing a single block within the chain.
*/
rpc RegisterBlockEpochNtfn (BlockEpoch) returns (stream BlockEpoch);
}

message ConfRequest {
/*
Expand Down Expand Up @@ -148,38 +186,3 @@ message BlockEpoch {
uint32 height = 2;
}

service ChainNotifier {
/*
RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified once a confirmation request
has reached its required number of confirmations on-chain.
A client can specify whether the confirmation request should be for a
particular transaction by its hash or for an output script by specifying a
zero hash.
*/
rpc RegisterConfirmationsNtfn (ConfRequest) returns (stream ConfEvent);

/*
RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
intent for a client to be notification once a spend request has been spent
by a transaction that has confirmed on-chain.
A client can specify whether the spend request should be for a particular
outpoint or for an output script by specifying a zero outpoint.
*/
rpc RegisterSpendNtfn (SpendRequest) returns (stream SpendEvent);

/*
RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
registers an intent for a client to be notified of blocks in the chain. The
stream will return a hash and height tuple of a block for each new/stale
block in the chain. It is the client's responsibility to determine whether
the tuple returned is for a new or stale block in the chain.
A client can also request a historical backlog of blocks from a particular
point. This allows clients to be idempotent by ensuring that they do not
missing processing a single block within the chain.
*/
rpc RegisterBlockEpochNtfn (BlockEpoch) returns (stream BlockEpoch);
}
Loading

0 comments on commit 8c3f2b2

Please sign in to comment.