diff --git a/chain/rpc.go b/chain/rpc.go index 1c48181..2eb386b 100644 --- a/chain/rpc.go +++ b/chain/rpc.go @@ -46,7 +46,7 @@ type RPCClient struct { // operate on the same bitcoin network as described by the passed chain // parameters, the connection will be disconnected. func NewRPCClient(chainParams *chaincfg.Params, connect, user, pass string, certs []byte, - disableTLS bool, reconnectAttempts int) (*RPCClient, error) { + disableTLS bool, skipverify bool, reconnectAttempts int) (*RPCClient, error) { if reconnectAttempts < 0 { return nil, errors.New("reconnectAttempts must be positive") @@ -62,6 +62,7 @@ func NewRPCClient(chainParams *chaincfg.Params, connect, user, pass string, cert DisableAutoReconnect: false, DisableConnectOnNew: true, DisableTLS: disableTLS, + SkipVerify: skipverify, }, chainParams: chainParams, reconnectAttempts: reconnectAttempts, diff --git a/config.go b/config.go index 796b566..b82ddbe 100644 --- a/config.go +++ b/config.go @@ -70,6 +70,7 @@ type config struct { RPCConnect string `short:"c" long:"rpcconnect" description:"Hostname/IP and port of lbcd RPC server to connect to (default localhost:9245, testnet: localhost:19245, regtest: localhost:29245 simnet: localhost:39245)"` CAFile *cfgutil.ExplicitString `long:"cafile" description:"File containing root certificates to authenticate a TLS connections with lbcd"` DisableClientTLS bool `long:"noclienttls" description:"Disable TLS for the RPC client -- NOTE: This is only allowed if the RPC client is connecting to localhost"` + SkipVerify bool `long:"skipverify" description:"Skip verifying TLS for the RPC client"` LbcdUsername string `long:"lbcdusername" description:"Username for lbcd authentication"` LbcdPassword string `long:"lbcdpassword" default-mask:"-" description:"Password for lbcd authentication"` Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"` diff --git a/lbcwallet.go b/lbcwallet.go index 8bafd54..d0c6f14 100644 --- a/lbcwallet.go +++ b/lbcwallet.go @@ -232,7 +232,8 @@ func readCAFile() []byte { func startChainRPC(certs []byte) (*chain.RPCClient, error) { log.Infof("Attempting RPC client connection to %v", cfg.RPCConnect) rpcc, err := chain.NewRPCClient(activeNet.Params, cfg.RPCConnect, - cfg.LbcdUsername, cfg.LbcdPassword, certs, cfg.DisableClientTLS, 0) + cfg.LbcdUsername, cfg.LbcdPassword, certs, cfg.DisableClientTLS, + cfg.SkipVerify, 0) if err != nil { return nil, err } diff --git a/rpc/api.proto b/rpc/api.proto index 7d69a73..5dfec9e 100644 --- a/rpc/api.proto +++ b/rpc/api.proto @@ -314,5 +314,6 @@ message StartConsensusRpcRequest { string username = 2; bytes password = 3; bytes certificate = 4; + bool skipverify = 5; } message StartConsensusRpcResponse {} diff --git a/rpc/rpcserver/server.go b/rpc/rpcserver/server.go index ce44aa5..e38f6c7 100644 --- a/rpc/rpcserver/server.go +++ b/rpc/rpcserver/server.go @@ -785,7 +785,7 @@ func (s *loaderServer) StartConsensusRpc(ctx context.Context, // nolint:golint } rpcClient, err := chain.NewRPCClient(s.activeNet.Params, networkAddress, req.Username, - string(req.Password), req.Certificate, len(req.Certificate) == 0, 1) + string(req.Password), req.Certificate, len(req.Certificate) == 0, req.SkipVerify, 1) if err != nil { return nil, translateError(err) } diff --git a/rpc/walletrpc/api.pb.go b/rpc/walletrpc/api.pb.go index 37369cc..98c3021 100644 --- a/rpc/walletrpc/api.pb.go +++ b/rpc/walletrpc/api.pb.go @@ -1435,6 +1435,7 @@ type StartConsensusRpcRequest struct { Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"` Password []byte `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` Certificate []byte `protobuf:"bytes,4,opt,name=certificate,proto3" json:"certificate,omitempty"` + SkipVerify bool `protobuf:"varint,5,opt,name=skipverify,proto3" json:"skipverify,omitempty"` } func (m *StartConsensusRpcRequest) Reset() { *m = StartConsensusRpcRequest{} }