Move json/cbor rpc to lib

This commit is contained in:
Łukasz Magiera
2019-07-08 13:02:02 +02:00
parent f06d874a8a
commit 4ef4721820
8 changed files with 36 additions and 33 deletions
+3 -3
View File
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
"github.com/filecoin-project/go-lotus/chain"
"github.com/filecoin-project/go-lotus/lib"
"github.com/filecoin-project/go-lotus/cborrpc"
"github.com/libp2p/go-libp2p-core/host"
"github.com/ipfs/go-cid"
@@ -46,7 +46,7 @@ func (hs *Service) HandleStream(s inet.Stream) {
defer s.Close()
var hmsg Message
if err := cborrpc.ReadCborRPC(s, &hmsg); err != nil {
if err := lib.ReadCborRPC(s, &hmsg); err != nil {
log.Infow("failed to read hello message", "error", err)
return
}
@@ -91,7 +91,7 @@ func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
fmt.Println("SENDING HELLO MESSAGE: ", hts.Cids())
fmt.Println("hello message genesis: ", gen.Cid())
if err := cborrpc.WriteCborRPC(s, hmsg); err != nil {
if err := lib.WriteCborRPC(s, hmsg); err != nil {
return err
}