2020-06-30 13:18:01 +00:00
|
|
|
package build
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sort"
|
|
|
|
|
2020-09-25 19:45:27 +00:00
|
|
|
"github.com/filecoin-project/go-address"
|
|
|
|
|
2020-06-30 13:18:01 +00:00
|
|
|
"github.com/libp2p/go-libp2p-core/protocol"
|
|
|
|
|
2020-09-07 03:49:10 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2020-09-18 21:59:27 +00:00
|
|
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
2020-06-30 13:18:01 +00:00
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
|
|
|
)
|
|
|
|
|
|
|
|
func DefaultSectorSize() abi.SectorSize {
|
2020-09-18 21:59:27 +00:00
|
|
|
szs := make([]abi.SectorSize, 0, len(miner0.SupportedProofTypes))
|
|
|
|
for spt := range miner0.SupportedProofTypes {
|
2020-06-30 13:18:01 +00:00
|
|
|
ss, err := spt.SectorSize()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
szs = append(szs, ss)
|
|
|
|
}
|
|
|
|
|
|
|
|
sort.Slice(szs, func(i, j int) bool {
|
|
|
|
return szs[i] < szs[j]
|
|
|
|
})
|
|
|
|
|
|
|
|
return szs[0]
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 DhtProtocolName(netName dtypes.NetworkName) protocol.ID {
|
|
|
|
return protocol.ID("/fil/kad/" + string(netName))
|
|
|
|
}
|
2020-09-10 18:53:10 +00:00
|
|
|
|
|
|
|
func UseNewestNetwork() bool {
|
|
|
|
// TODO: Put these in a container we can iterate over
|
|
|
|
if UpgradeBreezeHeight <= 0 && UpgradeSmokeHeight <= 0 {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
2020-09-25 19:45:27 +00:00
|
|
|
|
|
|
|
func SetAddressNetwork(n address.Network) {
|
|
|
|
address.CurrentNetwork = n
|
|
|
|
}
|