diff --git a/cmd/litd/main.go b/cmd/litd/main.go index df233a58..7e4f655d 100644 --- a/cmd/litd/main.go +++ b/cmd/litd/main.go @@ -6,7 +6,7 @@ import ( "os" "github.com/jessevdk/go-flags" - "github.com/lightninglabs/lightning-terminal" + terminal "github.com/lightninglabs/lightning-terminal" ) // main starts the lightning-terminal application. diff --git a/config.go b/config.go index 0dee3f20..b99ab1d8 100644 --- a/config.go +++ b/config.go @@ -758,10 +758,12 @@ func buildTLSConfigForHttp2(config *Config) (*tls.Config, error) { log.Infof("Listening for Let's Encrypt challenges on "+ "%v", config.LetsEncryptListen) - err := http.ListenAndServe( - config.LetsEncryptListen, - manager.HTTPHandler(nil), - ) + srv := &http.Server{ + Addr: config.LetsEncryptListen, + ReadHeaderTimeout: 3 * time.Second, + Handler: manager.HTTPHandler(nil), + } + err := srv.ListenAndServe() if err != nil { log.Errorf("Error starting Let's Encrypt "+ "HTTP listener on port 80: %v", err) diff --git a/itest/litd_mode_integrated_test.go b/itest/litd_mode_integrated_test.go index f4187d92..c268f4c5 100644 --- a/itest/litd_mode_integrated_test.go +++ b/itest/litd_mode_integrated_test.go @@ -495,7 +495,7 @@ func runUIPasswordCheck(t *testing.T, hostPort, tlsCertPath, uiPassword string, // provide a dummy macaroon but still the UI password must be // correct to pass. ctxm = uiPasswordContext(ctxt, uiPassword, true) - resp, err = makeRequest(ctxm, rawConn) + _, err = makeRequest(ctxm, rawConn) require.Error(t, err) require.Contains( diff --git a/itest/litd_node.go b/itest/litd_node.go index cbd52101..8cb5b2cc 100644 --- a/itest/litd_node.go +++ b/itest/litd_node.go @@ -728,7 +728,6 @@ func (hn *HarnessNode) waitForState(conn grpc.ClientConnInterface, }() select { - case <-started: case err = <-errChan: @@ -888,7 +887,6 @@ func (hn *HarnessNode) waitTillServerStarted() error { return nil } } - } // initLightningClient constructs the grpc LightningClient from the given client @@ -1258,7 +1256,6 @@ func (hn *HarnessNode) lightningNetworkWatcher() { for { select { - // A new graph update has just been received, so we'll examine // the current set of registered clients to see if we can // dispatch any requests. @@ -1779,7 +1776,6 @@ func (hn *HarnessNode) getChannelPolicies(include bool) policyUpdateMap { policyUpdates := policyUpdateMap{} for _, e := range graph.Edges { - policies := policyUpdates[e.ChanPoint] // If the map[op] is nil, we need to initialize the map first. diff --git a/itest/litd_test.go b/itest/litd_test.go index a00ff5b7..f79c57d1 100644 --- a/itest/litd_test.go +++ b/itest/litd_test.go @@ -94,15 +94,8 @@ func TestLightningTerminal(t *testing.T) { // case should naturally as a result and we log the server error here to // help debug. go func() { - for { - select { - case err, more := <-litdHarness.ProcessErrors(): - if !more { - return - } - ht.Logf("litd finished with error (stderr):\n%v", - err) - } + for err := range litdHarness.ProcessErrors() { + ht.Logf("litd finished with error (stderr):\n%v", err) } }() diff --git a/itest/network_harness.go b/itest/network_harness.go index 6e28a017..6ff01ce6 100644 --- a/itest/network_harness.go +++ b/itest/network_harness.go @@ -234,6 +234,7 @@ out: if aliceResp.ConfirmedBalance == expectedBalance && bobResp.ConfirmedBalance == expectedBalance { + break out } case <-balanceTimeout: @@ -259,7 +260,6 @@ func (n *NetworkHarness) TearDown() error { func (n *NetworkHarness) Stop() { close(n.lndErrorChan) close(n.quit) - } // NewNode initializes a new HarnessNode. @@ -420,7 +420,6 @@ func (n *NetworkHarness) EnsureConnected(t *testing.T, a, b *HarnessNode) { predErr = err return false } - }, lntest.DefaultTimeout) if err != nil { return fmt.Errorf("connection not succeeded within 15 "+ @@ -959,6 +958,7 @@ func (n *NetworkHarness) CloseChannel(lnNode *HarnessNode, // not. filterChannel := func(node *HarnessNode, op wire.OutPoint) (*lnrpc.Channel, error) { + listResp, err := node.ListChannels(ctx, listReq) if err != nil { return nil, err diff --git a/itest/test_harness.go b/itest/test_harness.go index 1f01d73b..5fda89d5 100644 --- a/itest/test_harness.go +++ b/itest/test_harness.go @@ -79,7 +79,6 @@ func (h *harnessTest) Fatalf(format string, a ...interface{}) { // RunTestCase executes a harness test case. Any errors or panics will be // represented as fatal. func (h *harnessTest) RunTestCase(testCase *testCase) { - h.testCase = testCase defer func() { h.testCase = nil diff --git a/session/metadata.go b/session/metadata.go index 1094eebb..fe5c52a8 100644 --- a/session/metadata.go +++ b/session/metadata.go @@ -81,7 +81,6 @@ func syncVersions(db *bbolt.DB) error { "db_version=%v", latestDBVersion, currentVersion) switch { - // If the database reports a higher version that we are aware of, the // user is probably trying to revert to a prior version of lnd. We fail // here to prevent reversions and unintended corruption. diff --git a/session/tlv.go b/session/tlv.go index 2cae453d..1f6e58f7 100644 --- a/session/tlv.go +++ b/session/tlv.go @@ -28,7 +28,7 @@ const ( // typeMacaroon is no longer used, but we leave it defined for backwards // compatibility. - typeMacaroon tlv.Type = 8 + typeMacaroon tlv.Type = 8 // nolint typeMacPerms tlv.Type = 1 typeMacCaveats tlv.Type = 2 @@ -182,7 +182,6 @@ func DeserializeSession(r io.Reader) (*Session, error) { // macaroonRecipeEncoder is a custom TLV encoder for a MacaroonRecipe record. func macaroonRecipeEncoder(w io.Writer, val interface{}, buf *[8]byte) error { if v, ok := val.(*MacaroonRecipe); ok { - var recipeTLVBytes bytes.Buffer tlvStream, err := tlv.NewStream( tlv.MakeDynamicRecord( @@ -225,7 +224,6 @@ func macaroonRecipeDecoder(r io.Reader, val interface{}, buf *[8]byte, l uint64) error { if v, ok := val.(*MacaroonRecipe); ok { - // Using this information, we'll create a new limited // reader that'll return an EOF once the end has been // reached so the stream stops consuming bytes. diff --git a/session/tlv_test.go b/session/tlv_test.go index 52f37003..d993ea87 100644 --- a/session/tlv_test.go +++ b/session/tlv_test.go @@ -13,9 +13,7 @@ import ( ) var ( - testRootKey = []byte("54321") - testID = []byte("dummyId") - testLocation = "lnd" + testRootKey = []byte("54321") perms = []bakery.Op{ {