Config for deal publishing control addresses
This commit is contained in:
parent
49896afe9f
commit
8f5c0c60f5
@ -280,14 +280,16 @@ const (
|
||||
PreCommitAddr AddrUse = iota
|
||||
CommitAddr
|
||||
PoStAddr
|
||||
DealPublishAddr
|
||||
|
||||
TerminateSectorsAddr
|
||||
)
|
||||
|
||||
type AddressConfig struct {
|
||||
PreCommitControl []address.Address
|
||||
CommitControl []address.Address
|
||||
TerminateControl []address.Address
|
||||
PreCommitControl []address.Address
|
||||
CommitControl []address.Address
|
||||
TerminateControl []address.Address
|
||||
DealPublishControl []address.Address
|
||||
|
||||
DisableOwnerFallback bool
|
||||
DisableWorkerFallback bool
|
||||
|
@ -435,6 +435,7 @@ var actorControlList = &cli.Command{
|
||||
commit := map[address.Address]struct{}{}
|
||||
precommit := map[address.Address]struct{}{}
|
||||
terminate := map[address.Address]struct{}{}
|
||||
dealPublish := map[address.Address]struct{}{}
|
||||
post := map[address.Address]struct{}{}
|
||||
|
||||
for _, ca := range mi.ControlAddresses {
|
||||
@ -471,6 +472,16 @@ var actorControlList = &cli.Command{
|
||||
terminate[ca] = struct{}{}
|
||||
}
|
||||
|
||||
for _, ca := range ac.DealPublishControl {
|
||||
ca, err := api.StateLookupID(ctx, ca, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(post, ca)
|
||||
dealPublish[ca] = struct{}{}
|
||||
}
|
||||
|
||||
printKey := func(name string, a address.Address) {
|
||||
b, err := api.WalletBalance(ctx, a)
|
||||
if err != nil {
|
||||
@ -515,6 +526,9 @@ var actorControlList = &cli.Command{
|
||||
if _, ok := terminate[a]; ok {
|
||||
uses = append(uses, color.YellowString("terminate"))
|
||||
}
|
||||
if _, ok := dealPublish[a]; ok {
|
||||
uses = append(uses, color.MagentaString("deals"))
|
||||
}
|
||||
|
||||
tw.Write(map[string]interface{}{
|
||||
"name": name,
|
||||
|
@ -182,9 +182,10 @@ type MinerFeeConfig struct {
|
||||
}
|
||||
|
||||
type MinerAddressConfig struct {
|
||||
PreCommitControl []string
|
||||
CommitControl []string
|
||||
TerminateControl []string
|
||||
PreCommitControl []string
|
||||
CommitControl []string
|
||||
TerminateControl []string
|
||||
DealPublishControl []string
|
||||
|
||||
// DisableOwnerFallback disables usage of the owner address for messages
|
||||
// sent automatically
|
||||
@ -404,8 +405,10 @@ func DefaultStorageMiner() *StorageMiner {
|
||||
},
|
||||
|
||||
Addresses: MinerAddressConfig{
|
||||
PreCommitControl: []string{},
|
||||
CommitControl: []string{},
|
||||
PreCommitControl: []string{},
|
||||
CommitControl: []string{},
|
||||
TerminateControl: []string{},
|
||||
DealPublishControl: []string{},
|
||||
},
|
||||
}
|
||||
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
|
||||
|
@ -188,6 +188,15 @@ func AddressSelector(addrConf *config.MinerAddressConfig) func() (*storage.Addre
|
||||
as.TerminateControl = append(as.TerminateControl, addr)
|
||||
}
|
||||
|
||||
for _, s := range addrConf.DealPublishControl {
|
||||
addr, err := address.NewFromString(s)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("parsing deal publishing control address: %w", err)
|
||||
}
|
||||
|
||||
as.DealPublishControl = append(as.DealPublishControl, addr)
|
||||
}
|
||||
|
||||
return as, nil
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi m
|
||||
addrs = append(addrs, as.CommitControl...)
|
||||
case api.TerminateSectorsAddr:
|
||||
addrs = append(addrs, as.TerminateControl...)
|
||||
case api.DealPublishAddr:
|
||||
addrs = append(addrs, as.DealPublishControl...)
|
||||
default:
|
||||
defaultCtl := map[address.Address]struct{}{}
|
||||
for _, a := range mi.ControlAddresses {
|
||||
@ -43,6 +45,7 @@ func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi m
|
||||
configCtl := append([]address.Address{}, as.PreCommitControl...)
|
||||
configCtl = append(configCtl, as.CommitControl...)
|
||||
configCtl = append(configCtl, as.TerminateControl...)
|
||||
configCtl = append(configCtl, as.DealPublishControl...)
|
||||
|
||||
for _, addr := range configCtl {
|
||||
if addr.Protocol() != address.ID {
|
||||
|
Loading…
Reference in New Issue
Block a user