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