diff options
author | Matthew Halpern <matthalp@gmail.com> | 2019-06-27 17:03:57 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-06-27 17:03:56 +0800 |
commit | 702f52fb99d60b4b6bab05799c14dafdd8648854 (patch) | |
tree | 9bd490130d0103826cc83b0fe37b80734acdfd4f | |
parent | 6069b1a5f5d17ee4a0ecf16c9eb0a521350bf5ad (diff) | |
download | go-tangerine-702f52fb99d60b4b6bab05799c14dafdd8648854.tar go-tangerine-702f52fb99d60b4b6bab05799c14dafdd8648854.tar.gz go-tangerine-702f52fb99d60b4b6bab05799c14dafdd8648854.tar.bz2 go-tangerine-702f52fb99d60b4b6bab05799c14dafdd8648854.tar.lz go-tangerine-702f52fb99d60b4b6bab05799c14dafdd8648854.tar.xz go-tangerine-702f52fb99d60b4b6bab05799c14dafdd8648854.tar.zst go-tangerine-702f52fb99d60b4b6bab05799c14dafdd8648854.zip |
les: prefer nil slices over zero-length slices (#19081)
-rw-r--r-- | les/handler_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/les/handler_test.go b/les/handler_test.go index c3608ebdd..dd7f1dbc4 100644 --- a/les/handler_test.go +++ b/les/handler_test.go @@ -159,7 +159,7 @@ func testGetBlockHeaders(t *testing.T, protocol int) { var reqID uint64 for i, tt := range tests { // Collect the headers to expect in the response - headers := []*types.Header{} + var headers []*types.Header for _, hash := range tt.expect { headers = append(headers, bc.GetHeaderByHash(hash)) } @@ -212,8 +212,9 @@ func testGetBlockBodies(t *testing.T, protocol int) { var reqID uint64 for i, tt := range tests { // Collect the hashes to request, and the response to expect - hashes, seen := []common.Hash{}, make(map[int64]bool) - bodies := []*types.Body{} + var hashes []common.Hash + seen := make(map[int64]bool) + var bodies []*types.Body for j := 0; j < tt.random; j++ { for { @@ -313,7 +314,8 @@ func testGetReceipt(t *testing.T, protocol int) { bc := server.pm.blockchain.(*core.BlockChain) // Collect the hashes to request, and the response to expect - hashes, receipts := []common.Hash{}, []types.Receipts{} + var receipts []types.Receipts + var hashes []common.Hash for i := uint64(0); i <= bc.CurrentBlock().NumberU64(); i++ { block := bc.GetBlockByNumber(i) |