Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
031bfaf120 | ||
|
|
f15a1edbf2 |
@@ -36,7 +36,7 @@ require (
|
||||
github.com/filecoin-project/go-data-transfer v1.14.0
|
||||
github.com/filecoin-project/go-fil-commcid v0.1.0
|
||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
|
||||
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220210121001-44fb837759c1
|
||||
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220215120226-a0db7a73d4fd
|
||||
github.com/filecoin-project/go-indexer-core v0.2.8
|
||||
github.com/filecoin-project/go-jsonrpc v0.1.5
|
||||
github.com/filecoin-project/go-legs v0.3.0
|
||||
|
||||
@@ -336,8 +336,8 @@ github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88Oq
|
||||
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
|
||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo=
|
||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
|
||||
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220210121001-44fb837759c1 h1:gGfvTCfHDCqEfVhGZSIALKtzF3D4p5Lhm4wH4KGv+60=
|
||||
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220210121001-44fb837759c1/go.mod h1:Q7EWzO9s4sg2KYBUJduTYdtVhVhusDuH2W0keyyub3I=
|
||||
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220215120226-a0db7a73d4fd h1:RO4M6fD9L6+OGqgk6OnMrFJcN5JkcMo3MX40vqxUfmQ=
|
||||
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220215120226-a0db7a73d4fd/go.mod h1:Q7EWzO9s4sg2KYBUJduTYdtVhVhusDuH2W0keyyub3I=
|
||||
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
|
||||
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
|
||||
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
|
||||
|
||||
+11
-5
@@ -23,22 +23,28 @@ type Libp2pMeshCreator struct {
|
||||
}
|
||||
|
||||
func (mc Libp2pMeshCreator) Connect(ctx context.Context) error {
|
||||
|
||||
// Add the index provider's host ID to list of protected peers first, before any attempt to
|
||||
// connect to full node.
|
||||
idxProvID := mc.idxProvHost.ID()
|
||||
if err := mc.fullnodeApi.NetProtectAdd(ctx, []peer.ID{idxProvID}); err != nil {
|
||||
return fmt.Errorf("failed to call NetProtectAdd on the full node, err: %w", err)
|
||||
}
|
||||
|
||||
faddrs, err := mc.fullnodeApi.NetAddrsListen(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to fetch full node listen addrs, err: %w", err)
|
||||
}
|
||||
|
||||
// otherwise, connect to the full node, ask it to protect the connection and protect the connection on our end too
|
||||
// Connect to the full node, ask it to protect the connection and protect the connection on
|
||||
// markets end too.
|
||||
if err := mc.idxProvHost.Connect(ctx, faddrs); err != nil {
|
||||
return fmt.Errorf("failed to connect index provider host with the full node: %w", err)
|
||||
}
|
||||
mc.idxProvHost.ConnManager().Protect(faddrs.ID, "index-provider-gossipsub")
|
||||
if err := mc.fullnodeApi.NetProtectAdd(ctx, []peer.ID{mc.idxProvHost.ID()}); err != nil {
|
||||
return fmt.Errorf("failed to call NetProtectAdd on the full node, err: %w", err)
|
||||
}
|
||||
|
||||
log.Debugw("successfully connected to full node and asked it protect indexer provider peer conn", "fullNodeInfo", faddrs.String(),
|
||||
"idxProviderPeerId", mc.idxProvHost.ID())
|
||||
"idxProviderPeerId", idxProvID)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user