Skip to content

Commit 98d5ede

Browse files
committed
linting
1 parent 38fd6f2 commit 98d5ede

File tree

5 files changed

+6
-20
lines changed

5 files changed

+6
-20
lines changed

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-go@v5
1717
with:
18-
go-version: '^1.20.0'
18+
go-version: "^1.20.0"
1919
- name: golangci-lint
2020
uses: golangci/golangci-lint-action@v3
2121
with:
22-
version: v1.51.2
22+
version: v1.55.2

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ format:
3636

3737
# look into .golangci.yml for enabling / disabling linters
3838
golangci_lint_cmd=golangci-lint
39-
golangci_version=v1.51.2
39+
golangci_version=v1.55.2
4040

4141
lint:
4242
@echo "--> Running linter"

db/memdb.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func newPair(key, value []byte) item {
3737
return item{key: key, value: value}
3838
}
3939

40-
// MemDB is an in-memory database backend using a B-tree for storage.
40+
// MemDB is an in-memory database backend using a B-tree for the test purpose.
4141
//
4242
// For performance reasons, all given and returned keys and values are pointers to the in-memory
4343
// database, so modifying them will cause the stored values to be modified as well. All DB methods

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/emicklei/dot v1.6.1
1010
github.com/gogo/protobuf v1.3.2
1111
github.com/golang/mock v1.6.0
12+
github.com/google/btree v1.1.2
1213
github.com/stretchr/testify v1.8.4
1314
golang.org/x/crypto v0.18.0
1415
)
@@ -26,7 +27,6 @@ require (
2627
github.com/davecgh/go-spew v1.1.1 // indirect
2728
github.com/fsnotify/fsnotify v1.5.4 // indirect
2829
github.com/golang/snappy v0.0.4 // indirect
29-
github.com/google/btree v1.1.2 // indirect
3030
github.com/klauspost/compress v1.15.9 // indirect
3131
github.com/kr/pretty v0.3.1 // indirect
3232
github.com/kr/text v0.2.0 // indirect

nodedb.go

+1-15
Original file line numberDiff line numberDiff line change
@@ -326,21 +326,7 @@ func (ndb *nodeDB) saveFastNodeUnlocked(node *fastnode.Node, shouldAddToCache bo
326326

327327
// Has checks if a node key exists in the database.
328328
func (ndb *nodeDB) Has(nk []byte) (bool, error) {
329-
key := ndb.nodeKey(nk)
330-
331-
// if ldb, ok := ndb.db.(*dbm.GoLevelDB); ok {
332-
// exists, err := ldb.DB().Has(key, nil)
333-
// if err != nil {
334-
// return false, err
335-
// }
336-
// return exists, nil
337-
// }
338-
value, err := ndb.db.Get(key)
339-
if err != nil {
340-
return false, err
341-
}
342-
343-
return value != nil, nil
329+
return ndb.db.Has(ndb.nodeKey(nk))
344330
}
345331

346332
// resetBatch reset the db batch, keep low memory used

0 commit comments

Comments
 (0)