Skip to content

Commit

Permalink
review feedback: change calcIDPath to leafPath 🍃
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Mar 19, 2021
1 parent 7c41c4b commit f9c4953
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions p2p/ipld/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func GetLeafData(
api coreiface.CoreAPI,
) ([]byte, error) {
// calculate the path to the leaf
leafPath, err := calcCIDPath(leafIndex, totalLeafs)
leafPath, err := leafPath(leafIndex, totalLeafs)
if err != nil {
return nil, err
}
Expand All @@ -43,7 +43,7 @@ func GetLeafData(
return node.RawData()[1:], nil
}

func calcCIDPath(index, total uint32) ([]string, error) {
func leafPath(index, total uint32) ([]string, error) {
// ensure that the total is a power of two
if total != nextPowerOf2(total) {
return nil, errors.New("expected total to be a power of 2")
Expand Down
4 changes: 2 additions & 2 deletions p2p/ipld/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/assert"
)

func TestCalcCIDPath(t *testing.T) {
func TestLeafPath(t *testing.T) {
type test struct {
name string
index, total uint32
Expand All @@ -40,7 +40,7 @@ func TestCalcCIDPath(t *testing.T) {
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
result, err := calcCIDPath(tt.index, tt.total)
result, err := leafPath(tt.index, tt.total)
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit f9c4953

Please sign in to comment.