lightningj-org / lightningj

Core implementation of the lightningj API implementations.
http://www.lightningj.org
GNU Lesser General Public License v3.0
47 stars 11 forks source link

openChannel error Synchronous API #60

Closed trybitcoin closed 11 months ago

trybitcoin commented 3 years ago

Subject of the issue

Trying to open a channel using the example from https://www.lightningj.org/ Other requests to my node like getInfo or listInvoices work as expected.

Your environment

Steps to reproduce

 OpenChannelRequest openChannelRequest = new OpenChannelRequest();
        String pubKeyZap = "03634bda49c9c42afd876d8288802942c49e58fbec3844ff54b46143bfcb6cdfaf";
        openChannelRequest.setNodePubkeyString(pubKeyZap);
        openChannelRequest.setLocalFundingAmount(40000);
        openChannelRequest.setPushSat(2500);
        openChannelRequest.setSatPerByte(13);
        Iterator<OpenStatusUpdate> result = createService().openChannel(openChannelRequest);
        while(result.hasNext()){
            System.out.println("Received Update: " + result.next().toJsonAsString(true));
        }

Expected behaviour

A channel from my node to zap should be opened.

Actual behaviour

` org.lightningj.lnd.wrapper.ServerSideException: UNKNOWN: NodePubkey is not set

at org.lightningj.lnd.wrapper.StatusExceptionWrapper.wrap(StatusExceptionWrapper.java:75)
at org.lightningj.lnd.wrapper.SynchronousLndAPI.openChannel(SynchronousLndAPI.java:124)
at myproject.lnd.Lnd.openChannelSynchronously(Lnd.java:113)
at myproject.lnd.LndTest.openChannelSynchronously(LndTest.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:124)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:74)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:108)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

Caused by: io.grpc.StatusRuntimeException: UNKNOWN: NodePubkey is not set at io.grpc.Status.asRuntimeException(Status.java:533) at io.grpc.stub.ClientCalls$BlockingResponseStream.hasNext(ClientCalls.java:584) at org.lightningj.lnd.wrapper.SynchronousAPI.processRepeatableResponse(SynchronousAPI.java:94) at org.lightningj.lnd.wrapper.SynchronousLndAPI.openChannel(SynchronousLndAPI.java:119) ... 53 more

`

herrvendil commented 3 years ago

Hi sorry for the late reply. The notification ended up in the spam mail for some reason.

The error is sent by LND Server so probably it is due some missing required parameter. The Proto documentation says / The pubkey of the node to open a channel with. When using REST, this field must be encoded as base64. / bytes node_pubkey = 2;

/*
The hex encoded pubkey of the node to open a channel with. Deprecated now
that the REST gateway supports base64 encoding of bytes fields.
*/
string node_pubkey_string = 3 [deprecated = true];

So it seems you are setting a deprecated paramter. Try setting just node_pubkey