Skip to content

Commit 7d044f5

Browse files
authored
Merge pull request #409 from lightninglabs/grpc-gateway-update
multi: update lnd to master with grpc-gateway upgrade
2 parents 7a3e3bd + a7fff0a commit 7d044f5

17 files changed

+1963
-1428
lines changed

go.mod

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,26 @@ require (
44
github.com/btcsuite/btcd v0.21.0-beta.0.20210513141527-ee5896bad5be
55
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
66
github.com/btcsuite/btcutil v1.0.3-0.20210527170813-e2ba6805a890
7-
github.com/btcsuite/btcwallet/wtxmgr v1.3.0
7+
github.com/btcsuite/btcwallet/wtxmgr v1.3.1-0.20210706234807-aaf03fee735a
88
github.com/coreos/bbolt v1.3.3
99
github.com/fortytw2/leaktest v1.3.0
10-
github.com/golang/protobuf v1.4.3
11-
github.com/grpc-ecosystem/grpc-gateway v1.14.3
10+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0
1211
github.com/jessevdk/go-flags v1.4.0
1312
github.com/lightninglabs/aperture v0.1.6-beta
1413
github.com/lightninglabs/lndclient v0.11.1-9
1514
github.com/lightninglabs/protobuf-hex-display v1.4.3-hex-display
16-
github.com/lightningnetwork/lnd v0.13.0-beta
15+
github.com/lightningnetwork/lnd v0.13.0-beta.rc5.0.20210728112744-ebabda671786
1716
github.com/lightningnetwork/lnd/cert v1.0.3
1817
github.com/lightningnetwork/lnd/clock v1.0.1
1918
github.com/lightningnetwork/lnd/queue v1.0.4
2019
github.com/lightningnetwork/lnd/ticker v1.0.0
2120
github.com/stretchr/testify v1.7.0
2221
github.com/urfave/cli v1.20.0
23-
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7
24-
google.golang.org/grpc v1.29.1
25-
google.golang.org/protobuf v1.23.0
22+
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
23+
google.golang.org/grpc v1.38.0
24+
google.golang.org/protobuf v1.26.0
2625
gopkg.in/macaroon-bakery.v2 v2.0.1
2726
gopkg.in/macaroon.v2 v2.1.0
2827
)
2928

30-
// Fix incompatibility of etcd go.mod package.
31-
// See https://github.com/etcd-io/etcd/issues/11154
32-
replace go.etcd.io/etcd => go.etcd.io/etcd v0.5.0-alpha.5.0.20201125193152-8a03d2e9614b
33-
3429
go 1.15

go.sum

Lines changed: 553 additions & 77 deletions
Large diffs are not rendered by default.

loopd/daemon.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import (
1212
"sync/atomic"
1313

1414
"github.com/coreos/bbolt"
15-
proxy "github.com/grpc-ecosystem/grpc-gateway/runtime"
15+
proxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
1616
"github.com/lightninglabs/lndclient"
1717
"github.com/lightninglabs/loop"
1818
"github.com/lightninglabs/loop/looprpc"
1919
"github.com/lightningnetwork/lnd/lntypes"
2020
"github.com/lightningnetwork/lnd/macaroons"
2121
"google.golang.org/grpc"
22+
"google.golang.org/protobuf/encoding/protojson"
2223
"gopkg.in/macaroon-bakery.v2/bakery"
2324
)
2425

@@ -237,8 +238,10 @@ func (d *Daemon) startWebServers() error {
237238
// that the marshaler prints all values, even if they are falsey.
238239
customMarshalerOption := proxy.WithMarshalerOption(
239240
proxy.MIMEWildcard, &proxy.JSONPb{
240-
OrigName: true,
241-
EmitDefaults: true,
241+
MarshalOptions: protojson.MarshalOptions{
242+
UseProtoNames: true,
243+
EmitUnpopulated: true,
244+
},
242245
},
243246
)
244247

loopd/swapclient_server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ var (
5555

5656
// swapClientServer implements the grpc service exposed by loopd.
5757
type swapClientServer struct {
58+
// Required by the grpc-gateway/v2 library for forward compatibility.
59+
looprpc.UnimplementedSwapClientServer
60+
looprpc.UnimplementedDebugServer
61+
5862
network lndclient.Network
5963
impl *loop.Client
6064
liquidityMgr *liquidity.Manager

looprpc/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.15.6-buster
1+
FROM golang:1.16.3-buster
22

33
RUN apt-get update && apt-get install -y \
44
git \
@@ -8,14 +8,17 @@ RUN apt-get update && apt-get install -y \
88
# We don't want any default values for these variables to make sure they're
99
# explicitly provided by parsing the go.mod file. Otherwise we might forget to
1010
# update them here if we bump the versions.
11-
ARG PROTOC_GEN_VERSION
11+
ARG PROTOBUF_VERSION
1212
ARG GRPC_GATEWAY_VERSION
1313

14+
ENV PROTOC_GEN_GO_GRPC_VERSION="v1.1.0"
15+
1416
RUN cd /tmp \
1517
&& export GO111MODULE=on \
16-
&& go get github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_VERSION} \
17-
&& go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@${GRPC_GATEWAY_VERSION} \
18-
&& go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@${GRPC_GATEWAY_VERSION}
18+
&& go get google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOBUF_VERSION} \
19+
&& go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION} \
20+
&& go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${GRPC_GATEWAY_VERSION} \
21+
&& go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${GRPC_GATEWAY_VERSION}
1922

2023
WORKDIR /build
2124

0 commit comments

Comments
 (0)