From 81dc65034dcb4b5772b1b4ac7c727f91319651dc Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Mon, 16 May 2022 18:08:51 +0200 Subject: [PATCH 1/3] use skipTempErr see https://github.com/lightningnetwork/lnd/pull/6545 --- .../lndmanagej/grpc/GrpcSendToRoute.java | 1 + .../lndmanagej/grpc/GrpcSendToRouteTest.java | 1 + grpc-client/src/main/proto/router.proto | 36 ++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/grpc-adapter/src/main/java/de/cotto/lndmanagej/grpc/GrpcSendToRoute.java b/grpc-adapter/src/main/java/de/cotto/lndmanagej/grpc/GrpcSendToRoute.java index 642958e8..c3502722 100644 --- a/grpc-adapter/src/main/java/de/cotto/lndmanagej/grpc/GrpcSendToRoute.java +++ b/grpc-adapter/src/main/java/de/cotto/lndmanagej/grpc/GrpcSendToRoute.java @@ -87,6 +87,7 @@ public class GrpcSendToRoute { return SendToRouteRequest.newBuilder() .setRoute(lndRoute) .setPaymentHash(ByteString.copyFrom(paymentHash.getByteArray())) + .setSkipTempErr(true) .build(); } diff --git a/grpc-adapter/src/test/java/de/cotto/lndmanagej/grpc/GrpcSendToRouteTest.java b/grpc-adapter/src/test/java/de/cotto/lndmanagej/grpc/GrpcSendToRouteTest.java index a44b368f..7c7278bf 100644 --- a/grpc-adapter/src/test/java/de/cotto/lndmanagej/grpc/GrpcSendToRouteTest.java +++ b/grpc-adapter/src/test/java/de/cotto/lndmanagej/grpc/GrpcSendToRouteTest.java @@ -68,6 +68,7 @@ class GrpcSendToRouteTest { void sends_to_converted_route() { grpcSendToRoute.sendToRoute(ROUTE, DECODED_PAYMENT_REQUEST, observer); RouterOuterClass.SendToRouteRequest expectedRequest = RouterOuterClass.SendToRouteRequest.newBuilder() + .setSkipTempErr(true) .setRoute(Route.newBuilder() .setTotalTimeLock(ROUTE.getTotalTimeLock(BLOCK_HEIGHT, DECODED_PAYMENT_REQUEST.cltvExpiry())) .addHops(Hop.newBuilder() diff --git a/grpc-client/src/main/proto/router.proto b/grpc-client/src/main/proto/router.proto index 79becfdf..04812b4d 100644 --- a/grpc-client/src/main/proto/router.proto +++ b/grpc-client/src/main/proto/router.proto @@ -284,6 +284,12 @@ message SendPaymentRequest { If set, an AMP-payment will be attempted. */ bool amp = 22; + + /* + The time preference for this payment. Set to -1 to optimize for fees + only, to 1 to optimize for reliability only or a value inbetween for a mix. + */ + double time_pref = 23; } message TrackPaymentRequest { @@ -330,6 +336,14 @@ message SendToRouteRequest { // Route that should be used to attempt to complete the payment. lnrpc.Route route = 2; + + /* + Whether the payment should be marked as failed when a temporary error is + returned from the given route. Set it to true so the payment won't be + failed unless a terminal error is occurred, such as payment timeout, no + routes, incorrect payment details, or insufficient funds. + */ + bool skip_temp_err = 3; } message SendToRouteResponse { @@ -360,6 +374,11 @@ message QueryMissionControlResponse { message XImportMissionControlRequest { // Node pair-level mission control state to be imported. repeated PairHistory pairs = 1; + + // Whether to force override MC pair history. Note that even with force + // override the failure pair is imported before the success pair and both + // still clamp existing failure/success amounts. + bool force = 2; } message XImportMissionControlResponse { @@ -678,7 +697,7 @@ enum PaymentState { FAILED_NO_ROUTE = 3; /* - A non-recoverable error has occured. + A non-recoverable error has occurred. */ FAILED_ERROR = 4; @@ -776,6 +795,21 @@ message ForwardHtlcInterceptResponse { // The preimage in case the resolve action is Settle. bytes preimage = 3; + + // Encrypted failure message in case the resolve action is Fail. + // + // If failure_message is specified, the failure_code field must be set + // to zero. + bytes failure_message = 4; + + // Return the specified failure code in case the resolve action is Fail. The + // message data fields are populated automatically. + // + // If a non-zero failure_code is specified, failure_message must not be set. + // + // For backwards-compatibility reasons, TEMPORARY_CHANNEL_FAILURE is the + // default value for this field. + lnrpc.Failure.FailureCode failure_code = 5; } enum ResolveHoldForwardAction { From 4d0d63626109b7d55256382e9f06ca533bc8158c Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Tue, 17 May 2022 12:15:43 +0200 Subject: [PATCH 2/3] add Dockerfile --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..4863bd17 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM gradle:latest +RUN apt-get update +RUN apt-get install postgresql sudo -y + +RUN git clone https://github.com/C-Otto/lnd-manageJ.git --branch fix-5746 +WORKDIR lnd-manageJ +RUN gradle application:bootJar + +RUN mkdir -p /root/.config +RUN echo "[lnd]" >> /root/.config/lnd-manageJ.conf +RUN echo "host=localhost" >> /root/.config/lnd-manageJ.conf +RUN echo "macaroon_file=/root/.lnd/data/chain/bitcoin/testnet/admin.macaroon" >> /root/.config/lnd-manageJ.conf + +EXPOSE 8081 +CMD /etc/init.d/postgresql start && \ + sudo -u postgres psql -c "CREATE USER bitcoin WITH PASSWORD 'unset'" && \ + sudo -u postgres createdb lndmanagej -O bitcoin && \ + java -jar application/build/libs/application-boot.jar + + +# docker build -t lnd-managej . +# docker run --network host -v /home/xxx/.lnd/:/root/.lnd lnd-managej From fcdede81ba1bc8a53dce41a8a81e2a6a80b17177 Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Tue, 17 May 2022 14:44:42 +0200 Subject: [PATCH 3/3] listen on all IPs --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4863bd17..4c71664c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,11 +12,11 @@ RUN echo "host=localhost" >> /root/.config/lnd-manageJ.conf RUN echo "macaroon_file=/root/.lnd/data/chain/bitcoin/testnet/admin.macaroon" >> /root/.config/lnd-manageJ.conf EXPOSE 8081 +RUN echo "server.address=0.0.0.0" >> /root/override.properties CMD /etc/init.d/postgresql start && \ sudo -u postgres psql -c "CREATE USER bitcoin WITH PASSWORD 'unset'" && \ sudo -u postgres createdb lndmanagej -O bitcoin && \ - java -jar application/build/libs/application-boot.jar - + java -jar application/build/libs/application-boot.jar --spring.config.location=classpath:application.properties,/root/override.properties # docker build -t lnd-managej . # docker run --network host -v /home/xxx/.lnd/:/root/.lnd lnd-managej