diff --git a/consensus/state.go b/consensus/state.go index c0a9b367ff..f491887e4e 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1116,7 +1116,7 @@ func (cs *State) defaultDecideProposal(height int64, round int32) { ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*1500) defer cancel() // TODO: post data to IPFS in a goroutine - err := block.PutBlock(ctx, cs.IpfsAPI.Dag().Pinning()) + err := block.PutBlock(ctx, cs.IpfsAPI.Dag()) if err != nil { cs.Logger.Error(fmt.Sprintf("failure to post block data to IPFS: %s", err.Error())) } diff --git a/p2p/ipld/read_test.go b/p2p/ipld/read_test.go index c0e6e75edd..0262ce7d0b 100644 --- a/p2p/ipld/read_test.go +++ b/p2p/ipld/read_test.go @@ -108,7 +108,7 @@ func TestGetLeafData(t *testing.T) { // create the context and batch needed for node collection from the tree ctx := context.Background() - batch := format.NewBatch(ctx, ipfsAPI.Dag().Pinning()) + batch := format.NewBatch(ctx, ipfsAPI.Dag()) // generate random data for the nmt data := generateRandNamespacedRawData(16, types.NamespaceSize, types.ShareSize) diff --git a/types/block_test.go b/types/block_test.go index 00725aaedb..5b8f37a6d7 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -17,7 +17,6 @@ import ( gogotypes "github.com/gogo/protobuf/types" coreapi "github.com/ipfs/go-ipfs/core/coreapi" coremock "github.com/ipfs/go-ipfs/core/mock" - "github.com/ipfs/interface-go-ipfs-core/path" "github.com/lazyledger/lazyledger-core/p2p/ipld/plugin/nodes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -1340,6 +1339,9 @@ func TestPutBlock(t *testing.T) { t.Error(err) } + maxOriginalSquareSize := MaxSquareSize / 2 + maxShareCount := maxOriginalSquareSize * maxOriginalSquareSize + testCases := []struct { name string blockData Data @@ -1349,7 +1351,7 @@ func TestPutBlock(t *testing.T) { {"no leaves", generateRandomMsgOnlyData(0), false, ""}, {"single leaf", generateRandomMsgOnlyData(1), false, ""}, {"16 leaves", generateRandomMsgOnlyData(16), false, ""}, - {"max square size", generateRandomMsgOnlyData(MaxSquareSize), false, ""}, + {"max square size", generateRandomMsgOnlyData(maxShareCount), false, ""}, } ctx := context.Background() for _, tc := range testCases { @@ -1358,7 +1360,7 @@ func TestPutBlock(t *testing.T) { block := &Block{Data: tc.blockData} t.Run(tc.name, func(t *testing.T) { - err = block.PutBlock(ctx, ipfsAPI.Dag().Pinning()) + err = block.PutBlock(ctx, ipfsAPI.Dag()) if tc.expectErr { require.Error(t, err) require.Contains(t, err.Error(), tc.errString) @@ -1378,15 +1380,6 @@ func TestPutBlock(t *testing.T) { t.Error(err) } - // check if cid was successfully pinned to IPFS - _, pinned, err := ipfsAPI.Pin().IsPinned(ctx, path.IpldPath(cid)) - if err != nil { - t.Error(err) - } - if !pinned { - t.Errorf("failure to pin cid %s to IPFS", cid.String()) - } - // retrieve the data from IPFS _, err = ipfsAPI.Dag().Get(timeoutCtx, cid) if err != nil {