From f9c49539a5652ca830242ec325d07540405e6719 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Thu, 18 Mar 2021 20:38:58 -0500 Subject: [PATCH] review feedback: change calcIDPath to leafPath :leaves: --- p2p/ipld/read.go | 4 ++-- p2p/ipld/read_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/p2p/ipld/read.go b/p2p/ipld/read.go index 989e7a8c60..6469b8dbfe 100644 --- a/p2p/ipld/read.go +++ b/p2p/ipld/read.go @@ -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 } @@ -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") diff --git a/p2p/ipld/read_test.go b/p2p/ipld/read_test.go index 9a66c75979..014642bfd8 100644 --- a/p2p/ipld/read_test.go +++ b/p2p/ipld/read_test.go @@ -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 @@ -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) }