mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
make+perms: allow itest to run with dev build tag
The dev flag allows us to enable some of lnd's configuration flags that are only available for testing. To speed up any wallet interaction, we also add the lowscrypt build tag that chooses weak encryption for the wallet that is much faster (a couple of milliseconds vs. multiple seconds per wallet creation).
This commit is contained in:
parent
9370c91286
commit
7cead0194a
3 changed files with 98 additions and 1 deletions
2
Makefile
2
Makefile
|
|
@ -94,7 +94,7 @@ DOCKER_TOOLS = docker run \
|
|||
-v $(shell bash -c "mkdir -p /tmp/go-lint-cache; echo /tmp/go-lint-cache"):/root/.cache/golangci-lint \
|
||||
-v $$(pwd):/build litd-tools
|
||||
|
||||
ITEST_TAGS := integration itest $(LND_RELEASE_TAGS)
|
||||
ITEST_TAGS := dev integration itest lowscrypt $(LND_RELEASE_TAGS)
|
||||
ITEST_LDFLAGS := $(call make_ldflags, $(ITEST_TAGS))
|
||||
|
||||
GREEN := "\\033[0;32m"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
//go:build !dev
|
||||
// +build !dev
|
||||
|
||||
package perms
|
||||
|
||||
import (
|
||||
|
|
|
|||
94
perms/mock_dev.go
Normal file
94
perms/mock_dev.go
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
//go:build dev
|
||||
// +build dev
|
||||
|
||||
package perms
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/lightningnetwork/lnd/autopilot"
|
||||
"github.com/lightningnetwork/lnd/chainreg"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/autopilotrpc"
|
||||
"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"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/watchtowerrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/wtclientrpc"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/routing"
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
)
|
||||
|
||||
// mockConfig implements lnrpc.SubServerConfigDispatcher. It provides the
|
||||
// functionality required so that the lnrpc.GrpcHandler.CreateSubServer
|
||||
// function can be called without panicking.
|
||||
type mockConfig struct{}
|
||||
|
||||
var _ lnrpc.SubServerConfigDispatcher = (*mockConfig)(nil)
|
||||
|
||||
// FetchConfig is a mock implementation of lnrpc.SubServerConfigDispatcher. It
|
||||
// is used as a parameter to lnrpc.GrpcHandler.CreateSubServer and allows the
|
||||
// function to be called without panicking. This is useful because
|
||||
// CreateSubServer can be used to extract the permissions required by each
|
||||
// registered subserver.
|
||||
//
|
||||
// TODO(elle): remove this once the sub-server permission lists in LND have been
|
||||
// exported
|
||||
func (t *mockConfig) FetchConfig(subServerName string) (interface{}, bool) {
|
||||
switch subServerName {
|
||||
case "InvoicesRPC":
|
||||
return &invoicesrpc.Config{}, true
|
||||
case "WatchtowerClientRPC":
|
||||
return &wtclientrpc.Config{
|
||||
Resolver: func(_, _ string) (*net.TCPAddr, error) {
|
||||
return nil, nil
|
||||
},
|
||||
}, true
|
||||
case "AutopilotRPC":
|
||||
return &autopilotrpc.Config{
|
||||
Manager: &autopilot.Manager{},
|
||||
}, true
|
||||
case "ChainRPC":
|
||||
return &chainrpc.Config{
|
||||
ChainNotifier: &chainreg.NoChainBackend{},
|
||||
Chain: &mock.ChainIO{},
|
||||
}, true
|
||||
case "DevRPC":
|
||||
return &devrpc.Config{
|
||||
ActiveNetParams: &chaincfg.RegressionNetParams,
|
||||
GraphDB: &channeldb.ChannelGraph{},
|
||||
}, true
|
||||
case "NeutrinoKitRPC":
|
||||
return &neutrinorpc.Config{}, true
|
||||
case "PeersRPC":
|
||||
return &peersrpc.Config{}, true
|
||||
case "RouterRPC":
|
||||
return &routerrpc.Config{
|
||||
Router: &routing.ChannelRouter{},
|
||||
}, true
|
||||
case "SignRPC":
|
||||
return &signrpc.Config{
|
||||
Signer: &mock.DummySigner{},
|
||||
}, true
|
||||
case "WalletKitRPC":
|
||||
return &walletrpc.Config{
|
||||
FeeEstimator: &chainreg.NoChainBackend{},
|
||||
Wallet: &mock.WalletController{},
|
||||
KeyRing: &mock.SecretKeyRing{},
|
||||
Sweeper: &sweep.UtxoSweeper{},
|
||||
Chain: &mock.ChainIO{},
|
||||
}, true
|
||||
case "WatchtowerRPC":
|
||||
return &watchtowerrpc.Config{}, true
|
||||
default:
|
||||
return nil, false
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue