From 3a3c8caab0a648900dc12b43100af37273fb1aed Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Mon, 19 Aug 2024 21:41:55 +0200 Subject: [PATCH] build: fix linter issues --- frdrpcserver/rpcserver.go | 6 +++++- itest/test_context.go | 25 ------------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/frdrpcserver/rpcserver.go b/frdrpcserver/rpcserver.go index 08fb710..80dfa1e 100644 --- a/frdrpcserver/rpcserver.go +++ b/frdrpcserver/rpcserver.go @@ -19,6 +19,7 @@ import ( "strings" "sync" "sync/atomic" + "time" proxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/lightninglabs/faraday/accounting" @@ -298,7 +299,10 @@ func (s *RPCServer) Start() error { if err != nil { return err } - s.restServer = &http.Server{Handler: restHandler} + s.restServer = &http.Server{ + Handler: restHandler, + ReadHeaderTimeout: 3 * time.Second, + } s.wg.Add(1) go func() { diff --git a/itest/test_context.go b/itest/test_context.go index 4b68c90..4b1e364 100644 --- a/itest/test_context.go +++ b/itest/test_context.go @@ -153,15 +153,6 @@ func (c *testContext) mine() int { return len(block.Transactions) - 1 } -// mine mines a block and verifies that the expected number of transactions is -// present (excluding the coinbase tx). -func (c *testContext) mineExactly(expectedTxCount int) { - c.t.Helper() - - txCount := c.mine() - require.Equal(c.t, expectedTxCount, txCount) -} - // mempoolTxCount returns the number of txes currently in the mempool. func (c *testContext) mempoolTxCount() int { txes, err := c.bitcoindClient.GetRawMempool() @@ -485,22 +476,6 @@ func (c *testContext) waitForMempoolTxCount(txCount int, msg string) { ) } -// waitForTxesAndMine waits for a specified number of txes to arrive in the -// mempool and then mines a block. -func (c *testContext) waitForTxesAndMine(txCount int, msg string) { - c.t.Helper() - - c.waitForMempoolTxCount(txCount, msg) - c.mineExactly(txCount) -} - -// mempoolEmpty asserts that the mempool is empty. -func (c *testContext) mempoolEmpty() { - c.t.Helper() - - require.Equal(c.t, 0, c.mempoolTxCount(), "mempool not empty") -} - // startFaraday starts faraday, connecting to our test context's alice lnd node. // It returns process start errors and an error channel for errors that occur // after the start.