Skip to content

Commit

Permalink
fix: assign variables to prevent slicing into nil (#28)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
  • Loading branch information
wolf31o2 authored Nov 11, 2024
1 parent f70bde0 commit 4fe8f08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (b *Branch) generateProof(path []Nibble) (*Proof, error) {
}

func (b *Branch) getChildren() []Node {
var ret []Node
ret := []Node{}
for _, tmpChild := range b.children {
if tmpChild != nil {
ret = append(ret, tmpChild)
Expand Down
2 changes: 1 addition & 1 deletion trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestTrieFruitsGet(t *testing.T) {

func TestTrieFruitsSetDeleteConsistentHash(t *testing.T) {
trie := NewTrie()
var hashes []Hash
hashes := []Hash{}
for _, entry := range fruitsTestEntries {
hashes = append(hashes, trie.Hash())
trie.Set([]byte(entry.key), []byte(entry.value))
Expand Down

0 comments on commit 4fe8f08

Please sign in to comment.