Skip to content

Commit

Permalink
try a thing
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jun 4, 2021
1 parent 77bc7e9 commit 5a21682
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chain/exchange/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (c *client) sendRequestToPeer(ctx context.Context, peer peer.ID, req *Reque
return nil, xerrors.Errorf("failed to get protocols for peer: %w", err)
}
if len(supported) == 0 || (supported[0] != BlockSyncProtocolID && supported[0] != ChainExchangeProtocolID) {
return nil, xerrors.Errorf("peer %s does not support protocols %s",
return nil, xerrors.Errorf("peer %s does not support protocols %s (supported: %s)",
peer, []string{BlockSyncProtocolID, ChainExchangeProtocolID})
}

Expand Down
5 changes: 5 additions & 0 deletions chain/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import (
"fmt"
"os"
"strings"
"syscall"
"testing"
"time"

"golang.org/x/sys/unix"

"github.com/filecoin-project/go-state-types/crypto"

"github.com/filecoin-project/go-state-types/network"
Expand Down Expand Up @@ -344,6 +347,8 @@ func (tu *syncTestUtil) waitIdentify(from int, pid peer.ID) {
}

if time.Now().After(deadline) {
fmt.Printf("peer didn't advertise chain xchg support: %+v\n", epi)
unix.Kill(os.Getpid(), syscall.SIGQUIT)
tu.t.Fatalf("peer didn't advertise chain xchg support: %+v", epi)
}

Expand Down
1 change: 1 addition & 0 deletions node/modules/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func RunPeerMgr(mctx helpers.MetricsCtx, lc fx.Lifecycle, pmgr *peermgr.PeerMgr)
func RunChainExchange(h host.Host, svc exchange.Server) {
h.SetStreamHandler(exchange.BlockSyncProtocolID, svc.HandleStream) // old
h.SetStreamHandler(exchange.ChainExchangeProtocolID, svc.HandleStream) // new
log.Error("debug - register chain xchg")
}

func waitForSync(stmgr *stmgr.StateManager, epochs int, subscribe func()) {
Expand Down

0 comments on commit 5a21682

Please sign in to comment.