Move api.MinerInfo to api/types
This commit is contained in:
parent
5cf76ba8b3
commit
1ccad22227
@ -299,39 +299,6 @@ type MinerPower struct {
|
|||||||
TotalPower power.Claim
|
TotalPower power.Claim
|
||||||
}
|
}
|
||||||
|
|
||||||
type MinerInfo struct {
|
|
||||||
Owner address.Address // Must be an ID-address.
|
|
||||||
Worker address.Address // Must be an ID-address.
|
|
||||||
NewWorker address.Address // Must be an ID-address.
|
|
||||||
WorkerChangeEpoch abi.ChainEpoch
|
|
||||||
PeerId peer.ID
|
|
||||||
Multiaddrs []abi.Multiaddrs
|
|
||||||
SealProofType abi.RegisteredProof
|
|
||||||
SectorSize abi.SectorSize
|
|
||||||
WindowPoStPartitionSectors uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewApiMinerInfo(info miner.MinerInfo) MinerInfo {
|
|
||||||
mi := MinerInfo{
|
|
||||||
Owner: info.Owner,
|
|
||||||
Worker: info.Worker,
|
|
||||||
NewWorker: address.Undef,
|
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
PeerId: peer.ID(info.PeerId),
|
|
||||||
Multiaddrs: info.Multiaddrs,
|
|
||||||
SealProofType: info.SealProofType,
|
|
||||||
SectorSize: info.SectorSize,
|
|
||||||
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
|
||||||
}
|
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi
|
|
||||||
}
|
|
||||||
|
|
||||||
type QueryOffer struct {
|
type QueryOffer struct {
|
||||||
Err string
|
Err string
|
||||||
|
|
||||||
|
36
api/types.go
36
api/types.go
@ -2,6 +2,9 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
ma "github.com/multiformats/go-multiaddr"
|
||||||
@ -39,3 +42,36 @@ type PubsubScore struct {
|
|||||||
ID peer.ID
|
ID peer.ID
|
||||||
Score float64
|
Score float64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MinerInfo struct {
|
||||||
|
Owner address.Address // Must be an ID-address.
|
||||||
|
Worker address.Address // Must be an ID-address.
|
||||||
|
NewWorker address.Address // Must be an ID-address.
|
||||||
|
WorkerChangeEpoch abi.ChainEpoch
|
||||||
|
PeerId peer.ID
|
||||||
|
Multiaddrs []abi.Multiaddrs
|
||||||
|
SealProofType abi.RegisteredProof
|
||||||
|
SectorSize abi.SectorSize
|
||||||
|
WindowPoStPartitionSectors uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewApiMinerInfo(info miner.MinerInfo) MinerInfo {
|
||||||
|
mi := MinerInfo{
|
||||||
|
Owner: info.Owner,
|
||||||
|
Worker: info.Worker,
|
||||||
|
NewWorker: address.Undef,
|
||||||
|
WorkerChangeEpoch: -1,
|
||||||
|
PeerId: peer.ID(info.PeerId),
|
||||||
|
Multiaddrs: info.Multiaddrs,
|
||||||
|
SealProofType: info.SealProofType,
|
||||||
|
SectorSize: info.SectorSize,
|
||||||
|
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
|
||||||
|
}
|
||||||
|
|
||||||
|
if info.PendingWorkerKey != nil {
|
||||||
|
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
||||||
|
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
||||||
|
}
|
||||||
|
|
||||||
|
return mi
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user