Skip to content

Commit

Permalink
Merge pull request #119 from lightninglabs/lnd-0.13
Browse files Browse the repository at this point in the history
Bump lnd dependency to v0.13.0-beta.rc2
  • Loading branch information
guggero authored May 18, 2021
2 parents fae9e63 + 824df2d commit c54b3df
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 117 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Faraday is a suite of tools built to help node operators and businesses run [lnd](https://github.com/lightningnetwork/lnd), the leading implementation of the [Lightning Network](https://github.com/lightningnetwork/lightning-rfc). Faraday’s tools decrease the operational overhead of running a Lightning node and make it easier to build businesses on Lightning. The current features in the Faraday suite provide insight into node channel performance and support for accounting with both on-chain and off-chain reports for lnd.
## LND
Note that Faraday requires lnd to be built with **all of its subservers** and requires running at least v0.11.0. Download the [official release binary](https://github.com/lightningnetwork/lnd/releases/tag/v0.11.0-beta) or see the [instructions](https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md) in the lnd repo for more detailed installation instructions. If you choose to build lnd from source, following command to enable all the relevant subservers:
Note that Faraday requires lnd to be built with **all of its subservers** and requires running at least v0.11.1. Download the [official release binary](https://github.com/lightningnetwork/lnd/releases/tag/v0.11.1-beta) or see the [instructions](https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md) in the lnd repo for more detailed installation instructions. If you choose to build lnd from source, following command to enable all the relevant subservers:

```
make install tags="signrpc walletrpc chainrpc invoicesrpc"
Expand Down
36 changes: 0 additions & 36 deletions cmd/faraday/log.go

This file was deleted.

3 changes: 2 additions & 1 deletion cmd/faraday/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"os"

"github.com/lightninglabs/faraday"
Expand All @@ -10,7 +11,7 @@ import (
// properly executed if os.Exit() is called.
func main() {
if err := faraday.Main(); err != nil {
log.Infof("Error starting faraday: %v", err)
_, _ = fmt.Fprintf(os.Stderr, "Error starting faraday: %v", err)
}

os.Exit(1)
Expand Down
16 changes: 11 additions & 5 deletions faraday.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/jessevdk/go-flags"
"github.com/lightninglabs/lndclient"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/signal"

"github.com/lightninglabs/faraday/chain"
Expand All @@ -34,6 +35,14 @@ func Main() error {
os.Exit(0)
}

// Hook interceptor for os signals.
shutdownInterceptor, err := signal.Intercept()
if err != nil {
return err
}
logWriter := build.NewRotatingLogWriter()
SetupLoggers(logWriter, shutdownInterceptor)

if err := ValidateConfig(&config); err != nil {
return fmt.Errorf("error validating config: %v", err)
}
Expand Down Expand Up @@ -82,16 +91,13 @@ func Main() error {

server := frdrpc.NewRPCServer(cfg)

// Catch intercept signals, then start the server.
if err := signal.Intercept(); err != nil {
return err
}
// Start the server.
if err := server.Start(); err != nil {
return err
}

// Run until the user terminates.
<-signal.ShutdownChannel()
<-shutdownInterceptor.ShutdownChannel()
log.Infof("Received shutdown signal.")

if err := server.Stop(); err != nil {
Expand Down
30 changes: 22 additions & 8 deletions frdrpc/macaroons.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/macaroons"
"github.com/lightningnetwork/lnd/rpcperms"
"google.golang.org/grpc"
"gopkg.in/macaroon-bakery.v2/bakery"
)
Expand Down Expand Up @@ -154,15 +155,28 @@ func (s *RPCServer) stopMacaroonService() error {

// macaroonInterceptor creates gRPC server options with the macaroon security
// interceptors.
func (s *RPCServer) macaroonInterceptor() []grpc.ServerOption {
unaryInterceptor := s.macaroonService.UnaryServerInterceptor(
RequiredPermissions,
)
streamInterceptor := s.macaroonService.StreamServerInterceptor(
RequiredPermissions,
)
func (s *RPCServer) macaroonInterceptor() ([]grpc.ServerOption, error) {
interceptor := rpcperms.NewInterceptorChain(log, false)

err := interceptor.Start()
if err != nil {
return nil, err
}

interceptor.SetWalletUnlocked()
interceptor.AddMacaroonService(s.macaroonService)

for method, permissions := range RequiredPermissions {
err := interceptor.AddPermission(method, permissions)
if err != nil {
return nil, err
}
}

unaryInterceptor := interceptor.MacaroonUnaryServerInterceptor()
streamInterceptor := interceptor.MacaroonStreamServerInterceptor()
return []grpc.ServerOption{
grpc.UnaryInterceptor(unaryInterceptor),
grpc.StreamInterceptor(streamInterceptor),
}
}, nil
}
6 changes: 4 additions & 2 deletions frdrpc/rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ func (s *RPCServer) Start() error {

// First we add the security interceptor to our gRPC server options that
// checks the macaroons for validity.
serverOpts := s.macaroonInterceptor()
serverOpts, err := s.macaroonInterceptor()
if err != nil {
return fmt.Errorf("error with macaroon interceptor: %v", err)
}

// Add our TLS configuration and then create our server instance. It's
// important that we let gRPC create the TLS listener and we don't just
Expand All @@ -190,7 +193,6 @@ func (s *RPCServer) Start() error {
s.grpcServer = grpc.NewServer(serverOpts...)

// Start the gRPC RPCServer listening for HTTP/2 connections.
var err error
log.Info("Starting gRPC listener")
s.rpcListener, err = net.Listen("tcp", s.cfg.RPCListen)
if err != nil {
Expand Down
20 changes: 11 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
module github.com/lightninglabs/faraday

require (
github.com/btcsuite/btcd v0.21.0-beta.0.20201208033208-6bd4c64a54fa
github.com/btcsuite/btcd v0.21.0-beta.0.20210429225535-ce697fe7e82b
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcutil v1.0.2
github.com/golang/protobuf v1.3.3
github.com/google/go-cmp v0.3.1 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/golang/protobuf v1.4.3
github.com/grpc-ecosystem/grpc-gateway v1.14.3
github.com/jessevdk/go-flags v1.4.0
github.com/lightninglabs/lndclient v0.11.0-5
github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d
github.com/lightningnetwork/lnd v0.12.0-beta.rc5
github.com/lightninglabs/lndclient v0.11.1-5
github.com/lightninglabs/protobuf-hex-display v1.4.3-hex-display
github.com/lightningnetwork/lnd v0.13.0-beta.rc2
github.com/lightningnetwork/lnd/cert v1.0.3
github.com/shopspring/decimal v1.2.0
github.com/stretchr/testify v1.5.1
github.com/stretchr/testify v1.7.0
github.com/urfave/cli v1.20.0
golang.org/x/text v0.3.2 // indirect
google.golang.org/grpc v1.29.1
gopkg.in/macaroon-bakery.v2 v2.0.1
gopkg.in/macaroon.v2 v2.1.0
)

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

go 1.15
Loading

0 comments on commit c54b3df

Please sign in to comment.