-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from lightningj-org/support_lnd_0_16_2
Added support for LND 0.16.2 Added service ChainKit
- Loading branch information
Showing
14 changed files
with
321 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ntegration-test/groovy/org/lightningj/lnd/wrapper/chainkit/ChainKitIntegrationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/************************************************************************ | ||
* * | ||
* LightningJ * | ||
* * | ||
* This software is free software; you can redistribute it and/or * | ||
* modify it under the terms of the GNU Lesser General Public License * | ||
* (LGPL-3.0-or-later) * | ||
* License as published by the Free Software Foundation; either * | ||
* version 3 of the License, or any later version. * | ||
* * | ||
* See terms of license at gnu.org. * | ||
* * | ||
*************************************************************************/ | ||
package org.lightningj.lnd.wrapper.chainkit | ||
|
||
|
||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
/** | ||
* Integration tests running the chainkit client APIs against a live test-net LND node. | ||
*/ | ||
class ChainKitIntegrationSpec extends Specification{ | ||
|
||
|
||
@Shared String lndHost | ||
@Shared int lndPort | ||
@Shared File tlsCertPath | ||
@Shared File macaroonPath | ||
|
||
SynchronousChainKitAPI synchronousAPI | ||
AsynchronousChainKitAPI asynchronousAPI | ||
|
||
def setupSpec(){ | ||
lndHost = System.getProperty("lightningj.integration.test.lnd.host") | ||
lndPort = Integer.parseInt(System.getProperty("lightningj.integration.test.lnd.port")) | ||
tlsCertPath = new File(System.getProperty("lightningj.integration.test.lnd.tlscertpath")) | ||
macaroonPath = new File(System.getProperty("lightningj.integration.test.lnd.macaroonpath")) | ||
} | ||
|
||
def setup(){ | ||
asynchronousAPI = new AsynchronousChainKitAPI(lndHost,lndPort,tlsCertPath, macaroonPath) | ||
synchronousAPI = new SynchronousChainKitAPI(lndHost,lndPort,tlsCertPath, macaroonPath) | ||
} | ||
|
||
def "Test to verify chainkit api is available"(){ | ||
expect: | ||
synchronousAPI.getBlockHash(123L) != null | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* This file is fetched from https://github.com/lightningnetwork/lnd/blob/master/lnrpc/rpc.proto | ||
* And is distributed under LNDs MIT License. | ||
* LND (561bf82) tag : Downloaded 2022-05-18 | ||
*/ | ||
syntax = "proto3"; | ||
|
||
package chainrpc; | ||
|
||
option java_package = "org.lightningj.lnd.chainkit.proto"; | ||
option go_package = "github.com/lightningnetwork/lnd/lnrpc/chainrpc"; | ||
|
||
// ChainKit is a service that can be used to get information from the | ||
// chain backend. | ||
service ChainKit { | ||
/* lncli: `chain getblock` | ||
GetBlock returns a block given the corresponding block hash. | ||
*/ | ||
rpc GetBlock (GetBlockRequest) returns (GetBlockResponse); | ||
|
||
/* lncli: `chain getbestblock` | ||
GetBestBlock returns the block hash and current height from the valid | ||
most-work chain. | ||
*/ | ||
rpc GetBestBlock (GetBestBlockRequest) returns (GetBestBlockResponse); | ||
|
||
/* lncli: `chain getblockhash` | ||
GetBlockHash returns the hash of the block in the best blockchain | ||
at the given height. | ||
*/ | ||
rpc GetBlockHash (GetBlockHashRequest) returns (GetBlockHashResponse); | ||
} | ||
|
||
message GetBlockRequest { | ||
// The hash of the requested block. | ||
bytes block_hash = 1; | ||
} | ||
|
||
// TODO(ffranr): The neutrino GetBlock response includes many | ||
// additional helpful fields. Consider adding them here also. | ||
message GetBlockResponse { | ||
// The raw bytes of the requested block. | ||
bytes raw_block = 1; | ||
} | ||
|
||
message GetBestBlockRequest { | ||
} | ||
|
||
message GetBestBlockResponse { | ||
// The hash of the best block. | ||
bytes block_hash = 1; | ||
|
||
// The height of the best block. | ||
int32 block_height = 2; | ||
} | ||
|
||
message GetBlockHashRequest { | ||
// Block height of the target best chain block. | ||
int64 block_height = 1; | ||
} | ||
|
||
message GetBlockHashResponse { | ||
// The hash of the best block at the specified height. | ||
bytes block_hash = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.