address review feedback

This commit is contained in:
whyrusleeping 2019-11-05 08:56:43 -08:00
parent 4321256992
commit 2816fb8866
2 changed files with 4 additions and 7 deletions

View File

@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/lotus/chain/address"
"github.com/filecoin-project/lotus/chain/types"
cborrpc "github.com/filecoin-project/lotus/lib/cborrpc"
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
@ -59,12 +60,12 @@ func dskeyForChannel(addr address.Address) datastore.Key {
func (ps *Store) putChannelInfo(ci *ChannelInfo) error {
k := dskeyForChannel(ci.Channel)
buf := new(bytes.Buffer)
if err := ci.MarshalCBOR(buf); err != nil {
b, err := cborrpc.Dump(ci)
if err != nil {
return err
}
return ps.ds.Put(k, buf.Bytes())
return ps.ds.Put(k, b)
}
func (ps *Store) getChannelInfo(addr address.Address) (*ChannelInfo, error) {

View File

@ -2,7 +2,6 @@ package retrieval
import (
"context"
"fmt"
"io"
"github.com/ipfs/go-blockservice"
@ -209,8 +208,6 @@ func (hnd *handlerDeal) accept(deal DealProposal) error {
return err
}
defer fmt.Println("leaving accept retrieval deal")
blocksToSend := (unixfs0.Size + build.UnixfsChunkSize - 1) / build.UnixfsChunkSize
for i := uint64(0); i < blocksToSend; {
data, offset, nd, err := hnd.ufsr.ReadBlock(context.TODO())
@ -234,7 +231,6 @@ func (hnd *handlerDeal) accept(deal DealProposal) error {
Data: nd.RawData(),
}
fmt.Println("retrieval sending block: ", i, blocksToSend, len(nd.RawData()))
if err := cborrpc.WriteCborRPC(hnd.stream, block); err != nil {
return err
}