trie: prefer nil slices over zero-length slices (#19084)

This commit is contained in:
Matthew Halpern
2019-02-19 05:50:11 -08:00
committed by Felix Lange
parent f1537b774c
commit 514a9472ad
4 changed files with 5 additions and 5 deletions

View File

@@ -157,7 +157,7 @@ func (s *Sync) AddRawEntry(hash common.Hash, depth int, parent common.Hash) {
// Missing retrieves the known missing nodes from the trie for retrieval.
func (s *Sync) Missing(max int) []common.Hash {
requests := []common.Hash{}
var requests []common.Hash
for !s.queue.Empty() && (max == 0 || len(requests) < max) {
requests = append(requests, s.queue.PopItem().(common.Hash))
}
@@ -254,7 +254,7 @@ func (s *Sync) children(req *request, object node) ([]*request, error) {
node node
depth int
}
children := []child{}
var children []child
switch node := (object).(type) {
case *shortNode: