From 635cffa8718d4b9fadb6269a5c15b834dc857d4a Mon Sep 17 00:00:00 2001 From: ErikEk Date: Mon, 23 Aug 2021 04:59:06 +0200 Subject: [PATCH] multi: add sub-server dep --- .github/workflows/release.yaml | 2 +- .golangci.yml | 1 + Makefile | 4 ++-- lnrpc/gen_protos.sh | 2 +- log.go | 2 ++ make/release_flags.mk | 4 ++-- make/testing_flags.mk | 2 +- subrpcserver_config.go | 12 ++++++++++++ 8 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 766965a29..7612e49df 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -94,7 +94,7 @@ jobs: Our release binaries are fully reproducible. Third parties are able to verify that the release binaries were produced properly without having to trust the release manager(s). See our [reproducible builds guide](https://github.com/lightningnetwork/lnd/tree/master/build/release) for how this can be achieved. The release binaries are compiled with `go${{ env.GO_VERSION }}`, which is required by verifiers to arrive at the same ones. - They include the following build tags: `autopilotrpc`, `signrpc`, `walletrpc`, `chainrpc`, `invoicesrpc`, `routerrpc`, `watchtowerrpc` and `monitoring`. Note that these are already included in the release script, so they do not need to be provided. + They include the following build tags: `autopilotrpc`, `signrpc`, `walletrpc`, `chainrpc`, `invoicesrpc`, `neutrinorpc`, `routerrpc`, `watchtowerrpc` and `monitoring`. Note that these are already included in the release script, so they do not need to be provided. The `make release` command can be used to ensure one rebuilds with all the same flags used for the release. If one wishes to build for only a single platform, then `make release sys= tag=` can be used. diff --git a/.golangci.yml b/.golangci.yml index 6c1fc1908..ec42542b0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,6 +17,7 @@ run: - chainrpc - dev - invoicesrpc + - neutrinorpc - peersrpc - signrpc - walletrpc diff --git a/Makefile b/Makefile index eeacf7f1e..dc7395e92 100644 --- a/Makefile +++ b/Makefile @@ -306,7 +306,7 @@ apple: vendor mobile-rpc ios: vendor mobile-rpc @$(call print, "Building iOS cxframework ($(IOS_BUILD)).") mkdir -p $(IOS_BUILD_DIR) - $(GOMOBILE_BIN) bind -target=ios,iossimulator -tags="mobile $(DEV_TAGS) autopilotrpc" $(LDFLAGS) -v -o $(IOS_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=ios,iossimulator -tags="mobile $(DEV_TAGS) autopilotrpc neutrinorpc" $(LDFLAGS) -v -o $(IOS_BUILD) $(MOBILE_PKG) macos: vendor mobile-rpc @$(call print, "Building macOS cxframework ($(IOS_BUILD)).") @@ -316,7 +316,7 @@ macos: vendor mobile-rpc android: vendor mobile-rpc @$(call print, "Building Android library ($(ANDROID_BUILD)).") mkdir -p $(ANDROID_BUILD_DIR) - $(GOMOBILE_BIN) bind -target=android -tags="mobile $(DEV_TAGS) autopilotrpc" $(LDFLAGS) -v -o $(ANDROID_BUILD) $(MOBILE_PKG) + $(GOMOBILE_BIN) bind -target=android -tags="mobile $(DEV_TAGS) autopilotrpc neutrinorpc" $(LDFLAGS) -v -o $(ANDROID_BUILD) $(MOBILE_PKG) mobile: ios android diff --git a/lnrpc/gen_protos.sh b/lnrpc/gen_protos.sh index fb01b71b8..c523a203e 100755 --- a/lnrpc/gen_protos.sh +++ b/lnrpc/gen_protos.sh @@ -48,7 +48,7 @@ function generate() { --custom_opt="$opts" \ lightning.proto stateservice.proto walletunlocker.proto - PACKAGES="autopilotrpc chainrpc invoicesrpc peersrpc routerrpc signrpc verrpc walletrpc watchtowerrpc wtclientrpc devrpc" + PACKAGES="autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc routerrpc signrpc verrpc walletrpc watchtowerrpc wtclientrpc devrpc" for package in $PACKAGES; do # Special import for the wallet kit. manual_import="" diff --git a/log.go b/log.go index 64156e2fc..747c807fd 100644 --- a/log.go +++ b/log.go @@ -25,6 +25,7 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/chainrpc" "github.com/lightningnetwork/lnd/lnrpc/devrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" + "github.com/lightningnetwork/lnd/lnrpc/neutrinorpc" "github.com/lightningnetwork/lnd/lnrpc/peersrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" @@ -141,6 +142,7 @@ func SetupLoggers(root *build.RotatingLogWriter, interceptor signal.Interceptor) AddSubLogger(root, "SGNR", interceptor, signrpc.UseLogger) AddSubLogger(root, "WLKT", interceptor, walletrpc.UseLogger) AddSubLogger(root, "ARPC", interceptor, autopilotrpc.UseLogger) + AddSubLogger(root, "NRPC", interceptor, neutrinorpc.UseLogger) AddSubLogger(root, "DRPC", interceptor, devrpc.UseLogger) AddSubLogger(root, "INVC", interceptor, invoices.UseLogger) AddSubLogger(root, "NANN", interceptor, netann.UseLogger) diff --git a/make/release_flags.mk b/make/release_flags.mk index a5e7f6108..10beb70d7 100644 --- a/make/release_flags.mk +++ b/make/release_flags.mk @@ -37,9 +37,9 @@ windows-386 \ windows-amd64 \ windows-arm -RELEASE_TAGS = autopilotrpc signrpc walletrpc chainrpc invoicesrpc watchtowerrpc monitoring peersrpc kvdb_postgres kvdb_etcd +RELEASE_TAGS = autopilotrpc signrpc walletrpc chainrpc invoicesrpc watchtowerrpc neutrinorpc monitoring peersrpc kvdb_postgres kvdb_etcd -WASM_RELEASE_TAGS = autopilotrpc signrpc walletrpc chainrpc invoicesrpc watchtowerrpc monitoring peersrpc +WASM_RELEASE_TAGS = autopilotrpc signrpc walletrpc chainrpc invoicesrpc watchtowerrpc neutrinorpc monitoring peersrpc # One can either specify a git tag as the version suffix or one is generated # from the current date. diff --git a/make/testing_flags.mk b/make/testing_flags.mk index 002ea4b17..a81ce19cc 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -1,5 +1,5 @@ DEV_TAGS = dev -RPC_TAGS = autopilotrpc chainrpc invoicesrpc peersrpc routerrpc signrpc verrpc walletrpc watchtowerrpc wtclientrpc +RPC_TAGS = autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc routerrpc signrpc verrpc walletrpc watchtowerrpc wtclientrpc LOG_TAGS = TEST_FLAGS = ITEST_FLAGS = diff --git a/subrpcserver_config.go b/subrpcserver_config.go index d9473edfd..362cbc3be 100644 --- a/subrpcserver_config.go +++ b/subrpcserver_config.go @@ -17,6 +17,7 @@ import ( "github.com/lightningnetwork/lnd/lnrpc/chainrpc" "github.com/lightningnetwork/lnd/lnrpc/devrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" + "github.com/lightningnetwork/lnd/lnrpc/neutrinorpc" "github.com/lightningnetwork/lnd/lnrpc/peersrpc" "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnrpc/signrpc" @@ -66,6 +67,10 @@ type subRPCServerConfigs struct { // as a gRPC service. PeersRPC *peersrpc.Config `group:"peersrpc" namespace:"peersrpc"` + // NeutrinoKitRPC is a sub-RPC server that exposes functionality allowing + // a client to interact with a running neutrino node. + NeutrinoKitRPC *neutrinorpc.Config `group:"neutrinorpc" namespace:"neutrinorpc"` + // RouterRPC is a sub-RPC server the exposes functionality that allows // clients to send payments on the network, and perform Lightning // payment related queries such as requests for estimates of off-chain @@ -250,6 +255,13 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config, reflect.ValueOf(genAmpInvoiceFeatures), ) + case *neutrinorpc.Config: + subCfgValue := extractReflectValue(subCfg) + + subCfgValue.FieldByName("NeutrinoCS").Set( + reflect.ValueOf(cc.Cfg.NeutrinoCS), + ) + // RouterRPC isn't conditionally compiled and doesn't need to be // populated using reflection. case *routerrpc.Config: