commit
8dfcbc160d
17
Makefile
17
Makefile
@ -22,8 +22,8 @@ HAVE_LINTER := $(shell command -v $(LINT_BIN) 2> /dev/null)
|
||||
|
||||
BTCD_DIR :=${GOPATH}/src/$(BTCD_PKG)
|
||||
|
||||
COMMIT := $(shell git rev-parse HEAD)
|
||||
LDFLAGS := -ldflags "-X main.Commit=$(COMMIT)"
|
||||
COMMIT := $(shell git describe --abbrev=40 --dirty --broken)
|
||||
LDFLAGS := -ldflags "-X $(PKG)/build.Commit=$(COMMIT)"
|
||||
|
||||
GLIDE_COMMIT := 84607742b10f492430762d038e954236bbaf23f7
|
||||
BTCD_COMMIT := $(shell cat Gopkg.toml | \
|
||||
@ -47,8 +47,11 @@ XARGS := xargs -L 1
|
||||
|
||||
include make/testing_flags.mk
|
||||
|
||||
DEV_TAGS := $(if ${tags},$(DEV_TAGS) ${tags},$(DEV_TAGS))
|
||||
PROD_TAGS := $(if ${tags},$(PROD_TAGS) ${tags},$(PROD_TAGS))
|
||||
|
||||
COVER = for dir in $(GOLISTCOVER); do \
|
||||
$(GOTEST) -tags="$(TEST_TAGS)" \
|
||||
$(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" \
|
||||
-covermode=count \
|
||||
-coverprofile=$$dir/profile.tmp $$dir; \
|
||||
\
|
||||
@ -130,13 +133,13 @@ btcd: $(GLIDE_BIN) $(BTCD_DIR)
|
||||
|
||||
build:
|
||||
@$(call print, "Building debug lnd and lncli.")
|
||||
$(GOBUILD) -tags="$(TEST_TAGS) ${tags}" -o lnd-debug $(LDFLAGS) $(PKG)
|
||||
$(GOBUILD) -tags="$(TEST_TAGS) ${tags}" -o lncli-debug $(LDFLAGS) $(PKG)/cmd/lncli
|
||||
$(GOBUILD) -tags="$(DEV_TAGS)" -o lnd-debug $(LDFLAGS) $(PKG)
|
||||
$(GOBUILD) -tags="$(DEV_TAGS)" -o lncli-debug $(LDFLAGS) $(PKG)/cmd/lncli
|
||||
|
||||
install:
|
||||
@$(call print, "Installing lnd and lncli.")
|
||||
go install -v -tags="${tags}" $(LDFLAGS) $(PKG)
|
||||
go install -v -tags="${tags}" $(LDFLAGS) $(PKG)/cmd/lncli
|
||||
go install -v -tags="$(PROD_TAGS)" $(LDFLAGS) $(PKG)
|
||||
go install -v -tags="$(PROD_TAGS)" $(LDFLAGS) $(PKG)/cmd/lncli
|
||||
|
||||
scratch: dep build
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
package autopilot
|
||||
|
||||
import "github.com/btcsuite/btclog"
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the caller
|
||||
@ -9,13 +12,13 @@ var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("ATPL", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/coreos/bbolt"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
@ -268,10 +267,6 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
channeldb.UseLogger(btclog.Disabled)
|
||||
lnwallet.UseLogger(btclog.Disabled)
|
||||
brarLog = btclog.Disabled
|
||||
|
||||
// Ensure that breached outputs are initialized before starting tests.
|
||||
if err := initBreachedOutputs(); err != nil {
|
||||
panic(err)
|
||||
|
36
build/deployment.go
Normal file
36
build/deployment.go
Normal file
@ -0,0 +1,36 @@
|
||||
package build
|
||||
|
||||
// DeploymentType is an enum specifying the deployment to compile.
|
||||
type DeploymentType byte
|
||||
|
||||
const (
|
||||
// Development is a deployment that includes extra testing hooks and
|
||||
// logging configurations.
|
||||
Development DeploymentType = iota
|
||||
|
||||
// Production is a deployment that strips out testing logic and uses
|
||||
// Default logging.
|
||||
Production
|
||||
)
|
||||
|
||||
// String returns a human readable name for a build type.
|
||||
func (b DeploymentType) String() string {
|
||||
switch b {
|
||||
case Development:
|
||||
return "development"
|
||||
case Production:
|
||||
return "production"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// IsProdBuild returns true if this is a production build.
|
||||
func IsProdBuild() bool {
|
||||
return Deployment == Production
|
||||
}
|
||||
|
||||
// IsDevBuild returns true if this is a development build.
|
||||
func IsDevBuild() bool {
|
||||
return Deployment == Development
|
||||
}
|
6
build/deployment_dev.go
Normal file
6
build/deployment_dev.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev
|
||||
|
||||
package build
|
||||
|
||||
// Deployment specifies a development build.
|
||||
const Deployment = Development
|
6
build/deployment_prod.go
Normal file
6
build/deployment_prod.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build !dev
|
||||
|
||||
package build
|
||||
|
||||
// Deployment specifies a production build.
|
||||
const Deployment = Production
|
95
build/log.go
Normal file
95
build/log.go
Normal file
@ -0,0 +1,95 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btclog"
|
||||
)
|
||||
|
||||
// LogType is an indicating the type of logging specified by the build flag.
|
||||
type LogType byte
|
||||
|
||||
const (
|
||||
// LogTypeNone indicates no logging.
|
||||
LogTypeNone LogType = iota
|
||||
|
||||
// LogTypeStdOut all logging is written directly to stdout.
|
||||
LogTypeStdOut
|
||||
|
||||
// LogTypeDefault logs to both stdout and a given io.PipeWriter.
|
||||
LogTypeDefault
|
||||
)
|
||||
|
||||
// String returns a human readable identifier for the logging type.
|
||||
func (t LogType) String() string {
|
||||
switch t {
|
||||
case LogTypeNone:
|
||||
return "none"
|
||||
case LogTypeStdOut:
|
||||
return "stdout"
|
||||
case LogTypeDefault:
|
||||
return "default"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// LogWriter is a stub type whose behavior can be changed using the build flags
|
||||
// "stdlog" and "nolog". The default behavior is to write to both stdout and the
|
||||
// RotatorPipe. Passing "stdlog" will cause it only to write to stdout, and
|
||||
// "nolog" implements Write as a no-op.
|
||||
type LogWriter struct {
|
||||
// RotatorPipe is the write-end pipe for writing to the log rotator. It
|
||||
// is written to by the Write method of the LogWriter type. This only
|
||||
// needs to be set if neither the stdlog or nolog builds are set.
|
||||
RotatorPipe *io.PipeWriter
|
||||
}
|
||||
|
||||
// NewSubLogger constructs a new subsystem log from the current LogWriter
|
||||
// implementation. This is primarily intended for use with stdlog, as the actual
|
||||
// writer is shared amongst all instantiations.
|
||||
func NewSubLogger(subsystem string,
|
||||
genSubLogger func(string) btclog.Logger) btclog.Logger {
|
||||
|
||||
switch Deployment {
|
||||
|
||||
// For production builds, generate a new subsystem logger from the
|
||||
// primary log backend. If no function is provided, logging will be
|
||||
// disabled.
|
||||
case Production:
|
||||
if genSubLogger != nil {
|
||||
return genSubLogger(subsystem)
|
||||
}
|
||||
|
||||
// For development builds, we must handle two distinct types of logging:
|
||||
// unit tests and running the live daemon, e.g. for integration testing.
|
||||
case Development:
|
||||
switch LoggingType {
|
||||
|
||||
// Default logging is used when running the standalone daemon.
|
||||
// We'll use the optional sublogger constructor to mimic the
|
||||
// production behavior.
|
||||
case LogTypeDefault:
|
||||
if genSubLogger != nil {
|
||||
return genSubLogger(subsystem)
|
||||
}
|
||||
|
||||
// Logging to stdout is used in unit tests. It is not important
|
||||
// that they share the same backend, since all output is written
|
||||
// to std out.
|
||||
case LogTypeStdOut:
|
||||
backend := btclog.NewBackend(&LogWriter{})
|
||||
logger := backend.Logger(subsystem)
|
||||
|
||||
// Set the logging level of the stdout logger to use the
|
||||
// configured logging level specified by build flags.
|
||||
level, _ := btclog.LevelFromString(LogLevel)
|
||||
logger.SetLevel(level)
|
||||
|
||||
return logger
|
||||
}
|
||||
}
|
||||
|
||||
// For any other configurations, we'll disable logging.
|
||||
return btclog.Disabled
|
||||
}
|
18
build/log_default.go
Normal file
18
build/log_default.go
Normal file
@ -0,0 +1,18 @@
|
||||
// +build !stdlog,!nolog
|
||||
|
||||
package build
|
||||
|
||||
import "os"
|
||||
|
||||
// LoggingType is a log type that writes to both stdout and the log rotator, if
|
||||
// present.
|
||||
const LoggingType = LogTypeDefault
|
||||
|
||||
// Write writes the byte slice to both stdout and the log rotator, if present.
|
||||
func (w *LogWriter) Write(b []byte) (int, error) {
|
||||
os.Stdout.Write(b)
|
||||
if w.RotatorPipe != nil {
|
||||
w.RotatorPipe.Write(b)
|
||||
}
|
||||
return len(b), nil
|
||||
}
|
11
build/log_nolog.go
Normal file
11
build/log_nolog.go
Normal file
@ -0,0 +1,11 @@
|
||||
// +build nolog
|
||||
|
||||
package build
|
||||
|
||||
// LoggingType is a log type that writes no logs.
|
||||
const LoggingType = LogTypeNone
|
||||
|
||||
// Write is a noop.
|
||||
func (w *LogWriter) Write(b []byte) (int, error) {
|
||||
return len(b), nil
|
||||
}
|
14
build/log_stdlog.go
Normal file
14
build/log_stdlog.go
Normal file
@ -0,0 +1,14 @@
|
||||
// +build stdlog
|
||||
|
||||
package build
|
||||
|
||||
import "os"
|
||||
|
||||
// LoggingType is a log type that only writes to stdout.
|
||||
const LoggingType = LogTypeStdOut
|
||||
|
||||
// Write writes the provided byte slice to stdout.
|
||||
func (w *LogWriter) Write(b []byte) (int, error) {
|
||||
os.Stdout.Write(b)
|
||||
return len(b), nil
|
||||
}
|
6
build/loglevel_critical.go
Normal file
6
build/loglevel_critical.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev,critical
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies a critical log level.
|
||||
var LogLevel = "critical"
|
6
build/loglevel_debug.go
Normal file
6
build/loglevel_debug.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev,debug
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies a debug log level.
|
||||
var LogLevel = "debug"
|
6
build/loglevel_default.go
Normal file
6
build/loglevel_default.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build !info,!debug,!trace,!warn,!error,!critical,!off
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies a default log level of info.
|
||||
var LogLevel = "info"
|
6
build/loglevel_error.go
Normal file
6
build/loglevel_error.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev,error
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies an error log level.
|
||||
var LogLevel = "error"
|
6
build/loglevel_info.go
Normal file
6
build/loglevel_info.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev,info
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies an info log level.
|
||||
var LogLevel = "info"
|
6
build/loglevel_off.go
Normal file
6
build/loglevel_off.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev,off
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies an off log level.
|
||||
var LogLevel = "off"
|
6
build/loglevel_trace.go
Normal file
6
build/loglevel_trace.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev,trace
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies a trace log level.
|
||||
var LogLevel = "trace"
|
6
build/loglevel_warn.go
Normal file
6
build/loglevel_warn.go
Normal file
@ -0,0 +1,6 @@
|
||||
// +build dev,warn
|
||||
|
||||
package build
|
||||
|
||||
// LogLevel specifies a warning log level.
|
||||
var LogLevel = "warn"
|
@ -3,7 +3,7 @@
|
||||
// Heavily inspired by https://github.com/btcsuite/btcd/blob/master/version.go
|
||||
// Copyright (C) 2015-2017 The Lightning Network Developers
|
||||
|
||||
package main
|
||||
package build
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@ -11,6 +11,10 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Commit stores the current commit hash of this build, this should be set using
|
||||
// the -ldflags during compilation.
|
||||
var Commit string
|
||||
|
||||
// semanticAlphabet
|
||||
const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-"
|
||||
|
||||
@ -26,14 +30,9 @@ const (
|
||||
appPreRelease = "beta"
|
||||
)
|
||||
|
||||
// appBuild is defined as a variable so it can be overridden during the build
|
||||
// process with '-ldflags "-X main.appBuild foo' if needed. It MUST only
|
||||
// contain characters from semanticAlphabet per the semantic versioning spec.
|
||||
var appBuild string
|
||||
|
||||
// version returns the application version as a properly formed string per the
|
||||
// Version returns the application version as a properly formed string per the
|
||||
// semantic versioning 2.0.0 spec (http://semver.org/).
|
||||
func version() string {
|
||||
func Version() string {
|
||||
// Start with the major, minor, and patch versions.
|
||||
version := fmt.Sprintf("%d.%d.%d", appMajor, appMinor, appPatch)
|
||||
|
||||
@ -46,15 +45,6 @@ func version() string {
|
||||
version = fmt.Sprintf("%s-%s", version, preRelease)
|
||||
}
|
||||
|
||||
// Append build metadata if there is any. The plus called for
|
||||
// by the semantic versioning spec is automatically appended and should
|
||||
// not be contained in the build metadata string. The build metadata
|
||||
// string is not appended if it contains invalid characters.
|
||||
build := normalizeVerString(appBuild)
|
||||
if build != "" {
|
||||
version = fmt.Sprintf("%s+%s", version, build)
|
||||
}
|
||||
|
||||
// Append commit hash of current build to version.
|
||||
version = fmt.Sprintf("%s commit=%s", version, Commit)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package bitcoindnotify
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package bitcoindnotify
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package btcdnotify
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package btcdnotify
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package chainntnfs
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package chainntnfs_test
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
package chainntnfs
|
||||
|
||||
import "github.com/btcsuite/btclog"
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// Log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the caller
|
||||
@ -9,13 +12,13 @@ var Log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("NTFN", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
Log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package neutrinonotify
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package chainntnfs
|
||||
|
||||
|
@ -1,21 +1,23 @@
|
||||
package channeldb
|
||||
|
||||
import "github.com/btcsuite/btclog"
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the caller
|
||||
// requests it.
|
||||
var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("CHDB", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
macaroon "gopkg.in/macaroon.v2"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/macaroons"
|
||||
@ -34,10 +35,6 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
// Commit stores the current commit hash of this build. This should be
|
||||
// set using -ldflags during compilation.
|
||||
Commit string
|
||||
|
||||
defaultLndDir = btcutil.AppDataDir("lnd", false)
|
||||
defaultTLSCertPath = filepath.Join(defaultLndDir, defaultTLSCertFilename)
|
||||
)
|
||||
@ -205,7 +202,7 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "lncli"
|
||||
app.Version = fmt.Sprintf("%s commit=%s", "0.5", Commit)
|
||||
app.Version = build.Version()
|
||||
app.Usage = "control plane for your Lightning Network Daemon (lnd)"
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
flags "github.com/jessevdk/go-flags"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch/hodl"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@ -323,7 +324,7 @@ func loadConfig() (*config, error) {
|
||||
appName = strings.TrimSuffix(appName, filepath.Ext(appName))
|
||||
usageMessage := fmt.Sprintf("Use %s -h to show usage", appName)
|
||||
if preCfg.ShowVersion {
|
||||
fmt.Println(appName, "version", version())
|
||||
fmt.Println(appName, "version", build.Version())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
// +build debug
|
||||
|
||||
package main
|
||||
|
||||
// DebugBuild signals that this is a debug build.
|
||||
const DebugBuild = true
|
@ -1,6 +0,0 @@
|
||||
// +build !debug
|
||||
|
||||
package main
|
||||
|
||||
// DebugBuild signals that this is a debug build.
|
||||
const DebugBuild = false
|
@ -1,6 +1,9 @@
|
||||
package contractcourt
|
||||
|
||||
import "github.com/btcsuite/btclog"
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the caller
|
||||
@ -9,13 +12,13 @@ var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("CNCT", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
@ -1,6 +1,9 @@
|
||||
package discovery
|
||||
|
||||
import "github.com/btcsuite/btclog"
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the caller
|
||||
@ -9,13 +12,13 @@ var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("DISC", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
@ -160,6 +160,8 @@ Arguments:
|
||||
- `pkg=<package>`
|
||||
- `case=<testcase>`
|
||||
- `timeout=<timeout>`
|
||||
- `log="stdlog[ <log-level>]"` prints logs to stdout
|
||||
- `<log-level>` can be `info` (default), `debug`, `trace`, `warn`, `error`, `critical`, or `off`
|
||||
|
||||
`unit-cover`
|
||||
------------
|
||||
@ -170,6 +172,8 @@ Arguments:
|
||||
- `pkg=<package>`
|
||||
- `case=<testcase>`
|
||||
- `timeout=<timeout>`
|
||||
- `log="stdlog[ <log-level>]"` prints logs to stdout
|
||||
- `<log-level>` can be `info` (default), `debug`, `trace`, `warn`, `error`, `critical`, or `off`
|
||||
|
||||
Related: [`unit`](#unit)
|
||||
|
||||
@ -181,6 +185,8 @@ Arguments:
|
||||
- `pkg=<package>`
|
||||
- `case=<testcase>`
|
||||
- `timeout=<timeout>`
|
||||
- `log="stdlog[ <log-level>]"` prints logs to stdout
|
||||
- `<log-level>` can be `info` (default), `debug`, `trace`, `warn`, `error`, `critical`, or `off`
|
||||
|
||||
Related: [`unit`](#unit)
|
||||
|
||||
|
@ -15,6 +15,9 @@ import (
|
||||
"github.com/coreos/bbolt"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/go-errors/errors"
|
||||
"golang.org/x/crypto/salsa20"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
@ -24,8 +27,6 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/routing"
|
||||
"golang.org/x/crypto/salsa20"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -18,12 +18,10 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/btcsuite/btcutil"
|
||||
_ "github.com/btcsuite/btcwallet/walletdb/bdb"
|
||||
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/contractcourt"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnpeer"
|
||||
@ -201,13 +199,6 @@ func (n *testNode) AddNewChannel(channel *channeldb.OpenChannel,
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
channeldb.UseLogger(btclog.Disabled)
|
||||
lnwallet.UseLogger(btclog.Disabled)
|
||||
contractcourt.UseLogger(btclog.Disabled)
|
||||
fndgLog = btclog.Disabled
|
||||
}
|
||||
|
||||
func createTestWallet(cdb *channeldb.DB, netParams *chaincfg.Params,
|
||||
notifier chainntnfs.ChainNotifier, wc lnwallet.WalletController,
|
||||
signer lnwallet.Signer, keyRing keychain.SecretKeyRing,
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package hodl
|
||||
|
||||
@ -61,7 +61,7 @@ func (c *Config) Mask() Mask {
|
||||
}
|
||||
|
||||
// NOTE: The value returned here will only honor the configuration if
|
||||
// the debug build flag is present. In production, this method always
|
||||
// the dev build flag is present. In production, this method always
|
||||
// returns hodl.MaskNone and Active(*) always returns false.
|
||||
return MaskFromFlags(flags...)
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
// +build !debug
|
||||
// +build !dev
|
||||
|
||||
package hodl
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build dev
|
||||
|
||||
package hodl
|
||||
|
||||
@ -7,9 +7,6 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DebugBuild signals that this is a debug build.
|
||||
const DebugBuild = true
|
||||
|
||||
// MaskFromFlags merges a variadic set of Flags into a single Mask.
|
||||
func MaskFromFlags(flags ...Flag) Mask {
|
||||
var mask Mask
|
@ -1,10 +1,7 @@
|
||||
// +build !debug
|
||||
// +build !dev
|
||||
|
||||
package hodl
|
||||
|
||||
// DebugBuild signals that this is a production build.
|
||||
const DebugBuild = false
|
||||
|
||||
// MaskFromFlags in production always returns MaskNone.
|
||||
func MaskFromFlags(_ ...Flag) Mask {
|
||||
return MaskNone
|
@ -3,6 +3,7 @@ package hodl_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch/hodl"
|
||||
)
|
||||
|
||||
@ -87,8 +88,8 @@ var hodlMaskTests = []struct {
|
||||
// correctly reports active for flags in the tests' expected flags, and inactive
|
||||
// for all others.
|
||||
func TestMask(t *testing.T) {
|
||||
if !hodl.DebugBuild {
|
||||
t.Fatalf("htlcswitch tests must be run with '-tags debug'")
|
||||
if !build.IsDevBuild() {
|
||||
t.Fatalf("htlcswitch tests must be run with '-tags=dev'")
|
||||
}
|
||||
|
||||
for i, test := range hodlMaskTests {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package htlcswitch
|
||||
|
||||
import "github.com/btcsuite/btclog"
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the caller
|
||||
@ -9,13 +12,13 @@ var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("HSWC", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
16
lnd.go
16
lnd.go
@ -37,6 +37,8 @@ import (
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
proxy "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
flags "github.com/jessevdk/go-flags"
|
||||
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
@ -54,10 +56,6 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
// Commit stores the current commit hash of this build. This should be
|
||||
// set using -ldflags during compilation.
|
||||
Commit string
|
||||
|
||||
cfg *config
|
||||
registeredChains = newChainRegistry()
|
||||
|
||||
@ -93,12 +91,6 @@ var (
|
||||
// defers created in the top-level scope of a main method aren't executed if
|
||||
// os.Exit() is called.
|
||||
func lndMain() error {
|
||||
defer func() {
|
||||
if logRotatorPipe != nil {
|
||||
ltndLog.Info("Shutdown complete")
|
||||
}
|
||||
}()
|
||||
|
||||
// Load the configuration, and parse any command line options. This
|
||||
// function will also set up logging properly.
|
||||
loadedConfig, err := loadConfig()
|
||||
@ -108,12 +100,14 @@ func lndMain() error {
|
||||
cfg = loadedConfig
|
||||
defer func() {
|
||||
if logRotator != nil {
|
||||
ltndLog.Info("Shutdown complete")
|
||||
logRotator.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
// Show version at startup.
|
||||
ltndLog.Infof("Version %s", version())
|
||||
ltndLog.Infof("Version: %s, build=%s, logging=%s",
|
||||
build.Version(), build.Deployment, build.LoggingType)
|
||||
|
||||
var network string
|
||||
switch {
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"github.com/btcsuite/btcwallet/chain"
|
||||
btcwallet "github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/btcsuite/btcwallet/wtxmgr"
|
||||
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// walletLog is a logger that is initialized with no output filters. This
|
||||
@ -14,13 +16,13 @@ var walletLog btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("LNWL", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
walletLog = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
58
log.go
58
log.go
@ -12,8 +12,10 @@ import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/jrick/logrotate/rotator"
|
||||
"github.com/lightninglabs/neutrino"
|
||||
|
||||
"github.com/lightningnetwork/lightning-onion"
|
||||
"github.com/lightningnetwork/lnd/autopilot"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/contractcourt"
|
||||
@ -24,16 +26,6 @@ import (
|
||||
"github.com/lightningnetwork/lnd/signal"
|
||||
)
|
||||
|
||||
// logWriter implements an io.Writer that outputs to both standard output and
|
||||
// the write-end pipe of an initialized log rotator.
|
||||
type logWriter struct{}
|
||||
|
||||
func (logWriter) Write(p []byte) (n int, err error) {
|
||||
os.Stdout.Write(p)
|
||||
logRotatorPipe.Write(p)
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
// Loggers per subsystem. A single backend logger is created and all subsystem
|
||||
// loggers created from it will write to the backend. When adding new
|
||||
// subsystems, add the subsystem logger variable here and to the
|
||||
@ -43,38 +35,36 @@ func (logWriter) Write(p []byte) (n int, err error) {
|
||||
// log file. This must be performed early during application startup by
|
||||
// calling initLogRotator.
|
||||
var (
|
||||
logWriter = &build.LogWriter{}
|
||||
|
||||
// backendLog is the logging backend used to create all subsystem
|
||||
// loggers. The backend must not be used before the log rotator has
|
||||
// been initialized, or data races and/or nil pointer dereferences will
|
||||
// occur.
|
||||
backendLog = btclog.NewBackend(logWriter{})
|
||||
backendLog = btclog.NewBackend(logWriter)
|
||||
|
||||
// logRotator is one of the logging outputs. It should be closed on
|
||||
// application shutdown.
|
||||
logRotator *rotator.Rotator
|
||||
|
||||
// logRotatorPipe is the write-end pipe for writing to the log rotator.
|
||||
// It is written to by the Write method of the logWriter type.
|
||||
logRotatorPipe *io.PipeWriter
|
||||
|
||||
ltndLog = backendLog.Logger("LTND")
|
||||
lnwlLog = backendLog.Logger("LNWL")
|
||||
peerLog = backendLog.Logger("PEER")
|
||||
discLog = backendLog.Logger("DISC")
|
||||
rpcsLog = backendLog.Logger("RPCS")
|
||||
srvrLog = backendLog.Logger("SRVR")
|
||||
ntfnLog = backendLog.Logger("NTFN")
|
||||
chdbLog = backendLog.Logger("CHDB")
|
||||
fndgLog = backendLog.Logger("FNDG")
|
||||
hswcLog = backendLog.Logger("HSWC")
|
||||
utxnLog = backendLog.Logger("UTXN")
|
||||
brarLog = backendLog.Logger("BRAR")
|
||||
cmgrLog = backendLog.Logger("CMGR")
|
||||
crtrLog = backendLog.Logger("CRTR")
|
||||
btcnLog = backendLog.Logger("BTCN")
|
||||
atplLog = backendLog.Logger("ATPL")
|
||||
cnctLog = backendLog.Logger("CNCT")
|
||||
sphxLog = backendLog.Logger("SPHX")
|
||||
ltndLog = build.NewSubLogger("LTND", backendLog.Logger)
|
||||
lnwlLog = build.NewSubLogger("LNWL", backendLog.Logger)
|
||||
peerLog = build.NewSubLogger("PEER", backendLog.Logger)
|
||||
discLog = build.NewSubLogger("DISC", backendLog.Logger)
|
||||
rpcsLog = build.NewSubLogger("RPCS", backendLog.Logger)
|
||||
srvrLog = build.NewSubLogger("SRVR", backendLog.Logger)
|
||||
ntfnLog = build.NewSubLogger("NTFN", backendLog.Logger)
|
||||
chdbLog = build.NewSubLogger("CHDB", backendLog.Logger)
|
||||
fndgLog = build.NewSubLogger("FNDG", backendLog.Logger)
|
||||
hswcLog = build.NewSubLogger("HSWC", backendLog.Logger)
|
||||
utxnLog = build.NewSubLogger("UTXN", backendLog.Logger)
|
||||
brarLog = build.NewSubLogger("BRAR", backendLog.Logger)
|
||||
cmgrLog = build.NewSubLogger("CMGR", backendLog.Logger)
|
||||
crtrLog = build.NewSubLogger("CRTR", backendLog.Logger)
|
||||
btcnLog = build.NewSubLogger("BTCN", backendLog.Logger)
|
||||
atplLog = build.NewSubLogger("ATPL", backendLog.Logger)
|
||||
cnctLog = build.NewSubLogger("CNCT", backendLog.Logger)
|
||||
sphxLog = build.NewSubLogger("SPHX", backendLog.Logger)
|
||||
)
|
||||
|
||||
// Initialize package-global logger variables.
|
||||
@ -134,8 +124,8 @@ func initLogRotator(logFile string, MaxLogFileSize int, MaxLogFiles int) {
|
||||
pr, pw := io.Pipe()
|
||||
go r.Run(pr)
|
||||
|
||||
logWriter.RotatorPipe = pw
|
||||
logRotator = r
|
||||
logRotatorPipe = pw
|
||||
}
|
||||
|
||||
// setLogLevel sets the logging level for provided subsystem. Invalid
|
||||
|
@ -1,4 +1,6 @@
|
||||
TEST_TAGS = debug
|
||||
DEV_TAGS = dev
|
||||
PROD_TAGS = prod
|
||||
LOG_TAGS =
|
||||
TEST_FLAGS =
|
||||
|
||||
# If specific package is being unit tested, construct the full name of the
|
||||
@ -19,6 +21,14 @@ ifneq ($(icase),)
|
||||
TEST_FLAGS += -test.run=TestLightningNetworkDaemon/$(icase)
|
||||
endif
|
||||
|
||||
# Define the log tags that will be applied only when running unit tests. If none
|
||||
# are provided, we default to "nolog" which will be silent.
|
||||
ifneq ($(log),)
|
||||
LOG_TAGS := ${log}
|
||||
else
|
||||
LOG_TAGS := nolog
|
||||
endif
|
||||
|
||||
# If a timeout was requested, construct initialize the proper flag for the go
|
||||
# test command. If not, we set 20m (up from the default 10m).
|
||||
ifneq ($(timeout),)
|
||||
@ -34,16 +44,16 @@ UNIT_TARGETED ?= no
|
||||
# If a specific package/test case was requested, run the unit test for the
|
||||
# targeted case. Otherwise, default to running all tests.
|
||||
ifeq ($(UNIT_TARGETED), yes)
|
||||
UNIT := $(GOTEST) -tags="$(TEST_TAGS)" $(TEST_FLAGS) $(UNITPKG)
|
||||
UNIT_RACE := $(GOTEST) -tags="$(TEST_TAGS)" $(TEST_FLAGS) -race $(UNITPKG)
|
||||
UNIT := $(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" $(TEST_FLAGS) $(UNITPKG)
|
||||
UNIT_RACE := $(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" $(TEST_FLAGS) -race $(UNITPKG)
|
||||
endif
|
||||
|
||||
ifeq ($(UNIT_TARGETED), no)
|
||||
UNIT := $(GOLIST) | $(XARGS) $(GOTEST) -tags="$(TEST_TAGS)" $(TEST_FLAGS)
|
||||
UNIT := $(GOLIST) | $(XARGS) $(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" $(TEST_FLAGS)
|
||||
UNIT_RACE := $(UNIT) -race
|
||||
endif
|
||||
|
||||
|
||||
# Construct the integration test command with the added build flags.
|
||||
ITEST_TAGS := $(TEST_TAGS) rpctest
|
||||
ITEST_TAGS := $(DEV_TAGS) rpctest
|
||||
ITEST := rm output*.log; date; $(GOTEST) -tags="$(ITEST_TAGS)" $(TEST_FLAGS) -logoutput
|
||||
|
@ -9,16 +9,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Disable logging to prevent panics bc. of global state
|
||||
channeldb.UseLogger(btclog.Disabled)
|
||||
utxnLog = btclog.Disabled
|
||||
}
|
||||
|
||||
// makeTestDB creates a new instance of the ChannelDB for testing purposes. A
|
||||
// callback which cleans up the created temporary directories is also returned
|
||||
// and intended to be executed after the test completes.
|
||||
|
1
peer.go
1
peer.go
@ -16,6 +16,7 @@ import (
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
|
||||
"github.com/lightningnetwork/lnd/brontide"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
|
12
peer_test.go
12
peer_test.go
@ -7,26 +7,14 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/contractcourt"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
func init() {
|
||||
peerLog = btclog.Disabled
|
||||
srvrLog = btclog.Disabled
|
||||
lnwallet.UseLogger(btclog.Disabled)
|
||||
htlcswitch.UseLogger(btclog.Disabled)
|
||||
channeldb.UseLogger(btclog.Disabled)
|
||||
contractcourt.UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// TestPeerChannelClosureAcceptFeeResponder tests the shutdown responder's
|
||||
// behavior if we can agree on the fee immediately.
|
||||
func TestPeerChannelClosureAcceptFeeResponder(t *testing.T) {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package chainview
|
||||
|
||||
import "github.com/btcsuite/btclog"
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// log is a logger that is initialized with no output filters. This
|
||||
// means the package will not perform any logging by default until the caller
|
||||
@ -9,13 +12,13 @@ var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("CRTR", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until either UseLogger or SetLogWriter are called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
@ -2,6 +2,7 @@ package routing
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/routing/chainview"
|
||||
)
|
||||
|
||||
@ -12,13 +13,13 @@ var log btclog.Logger
|
||||
|
||||
// The default amount of logging is none.
|
||||
func init() {
|
||||
DisableLog()
|
||||
UseLogger(build.NewSubLogger("CRTR", nil))
|
||||
}
|
||||
|
||||
// DisableLog disables all library log output. Logging output is disabled by
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info. This
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||
"github.com/coreos/bbolt"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
@ -1190,12 +1191,12 @@ out:
|
||||
func (r *rpcServer) AbandonChannel(ctx context.Context,
|
||||
in *lnrpc.AbandonChannelRequest) (*lnrpc.AbandonChannelResponse, error) {
|
||||
|
||||
// If this isn't the debug build, then we won't allow the RPC to be
|
||||
// If this isn't the dev build, then we won't allow the RPC to be
|
||||
// executed, as it's an advanced feature and won't be activated in
|
||||
// regular production/release builds.
|
||||
if !DebugBuild {
|
||||
if !build.IsDevBuild() {
|
||||
return nil, fmt.Errorf("AbandonChannel RPC call only " +
|
||||
"available in debug builds")
|
||||
"available in dev builds")
|
||||
}
|
||||
|
||||
// We'll parse out the arguments to we can obtain the chanPoint of the
|
||||
@ -1364,7 +1365,7 @@ func (r *rpcServer) GetInfo(ctx context.Context,
|
||||
Uris: uris,
|
||||
Alias: nodeAnn.Alias.String(),
|
||||
BestHeaderTimestamp: int64(bestHeaderTimestamp),
|
||||
Version: version(),
|
||||
Version: build.Version(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ func init() {
|
||||
// DisableLog disables all library log output. Logging output is disabled
|
||||
// by default until UseLogger is called.
|
||||
func DisableLog() {
|
||||
log = btclog.Disabled
|
||||
UseLogger(btclog.Disabled)
|
||||
}
|
||||
|
||||
// UseLogger uses a specified Logger to output package logging info.
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
|
Loading…
Reference in New Issue
Block a user