lotus/build/params_shared_funcs.go

44 lines
976 B
Go
Raw Normal View History

package build
import (
"github.com/filecoin-project/go-address"
2021-04-09 06:58:22 +00:00
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
// Core network constants
func BlocksTopic(netName dtypes.NetworkName) string { return "/fil/blocks/" + string(netName) }
func MessagesTopic(netName dtypes.NetworkName) string { return "/fil/msgs/" + string(netName) }
func IndexerIngestTopic(netName dtypes.NetworkName) string {
return "/indexer/ingest/" + string(netName)
}
func DhtProtocolName(netName dtypes.NetworkName) protocol.ID {
return protocol.ID("/fil/kad/" + string(netName))
}
2020-09-10 18:53:10 +00:00
func SetAddressNetwork(n address.Network) {
address.CurrentNetwork = n
}
func MustParseAddress(addr string) address.Address {
ret, err := address.NewFromString(addr)
if err != nil {
panic(err)
}
return ret
}
2021-04-09 06:58:22 +00:00
func MustParseCid(c string) cid.Cid {
ret, err := cid.Decode(c)
if err != nil {
panic(err)
}
return ret
}