Merge remote-tracking branch 'origin/master' into feat/post-worker
This commit is contained in:
@@ -1272,7 +1272,7 @@ func (a *API) ClientCalcCommP(ctx context.Context, inpath string) (*api.CommPRet
|
||||
//
|
||||
// IF/WHEN this changes in the future we will have to be able to calculate
|
||||
// "old style" commP, and thus will need to introduce a version switch or similar
|
||||
arbitraryProofType := abi.RegisteredSealProof_StackedDrg32GiBV1_1
|
||||
arbitraryProofType := abi.RegisteredSealProof_StackedDrg64GiBV1_1
|
||||
|
||||
rdr, err := os.Open(inpath)
|
||||
if err != nil {
|
||||
|
||||
@@ -22,8 +22,6 @@ import (
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/ipfs/go-merkledag"
|
||||
"github.com/ipfs/go-path"
|
||||
"github.com/ipfs/go-path/resolver"
|
||||
mh "github.com/multiformats/go-multihash"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
@@ -36,6 +34,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/lib/oldpath"
|
||||
"github.com/filecoin-project/lotus/lib/oldpath/oldresolver"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
@@ -550,17 +550,16 @@ func resolveOnce(bs blockstore.Blockstore, tse stmgr.Executor) func(ctx context.
|
||||
}
|
||||
|
||||
func (a *ChainAPI) ChainGetNode(ctx context.Context, p string) (*api.IpldObject, error) {
|
||||
ip, err := path.ParsePath(p)
|
||||
ip, err := oldpath.ParsePath(p)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("parsing path: %w", err)
|
||||
}
|
||||
|
||||
bs := a.ExposedBlockstore
|
||||
bsvc := blockservice.New(bs, offline.Exchange(bs))
|
||||
|
||||
dag := merkledag.NewDAGService(bsvc)
|
||||
|
||||
r := &resolver.Resolver{
|
||||
r := &oldresolver.Resolver{
|
||||
DAG: dag,
|
||||
ResolveOnce: resolveOnce(bs, a.TsExec),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package net
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
)
|
||||
|
||||
const apiProtectTag = "api"
|
||||
|
||||
func (a *NetAPI) NetProtectAdd(ctx context.Context, peers []peer.ID) error {
|
||||
for _, p := range peers {
|
||||
a.Host.ConnManager().Protect(p, apiProtectTag)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *NetAPI) NetProtectRemove(ctx context.Context, peers []peer.ID) error {
|
||||
for _, p := range peers {
|
||||
a.Host.ConnManager().Unprotect(p, apiProtectTag)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *NetAPI) NetProtectList(ctx context.Context) (result []peer.ID, err error) {
|
||||
for _, conn := range a.Host.Network().Conns() {
|
||||
if a.Host.ConnManager().IsProtected(conn.RemotePeer(), apiProtectTag) {
|
||||
result = append(result, conn.RemotePeer())
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@@ -22,8 +22,26 @@ type PaychAPI struct {
|
||||
PaychMgr *paychmgr.Manager
|
||||
}
|
||||
|
||||
func (a *PaychAPI) PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error) {
|
||||
ch, mcid, err := a.PaychMgr.GetPaych(ctx, from, to, amt)
|
||||
func (a *PaychAPI) PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt, opts api.PaychGetOpts) (*api.ChannelInfo, error) {
|
||||
ch, mcid, err := a.PaychMgr.GetPaych(ctx, from, to, amt, paychmgr.GetOpts{
|
||||
Reserve: true,
|
||||
OffChain: opts.OffChain,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &api.ChannelInfo{
|
||||
Channel: ch,
|
||||
WaitSentinel: mcid,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *PaychAPI) PaychFund(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error) {
|
||||
ch, mcid, err := a.PaychMgr.GetPaych(ctx, from, to, amt, paychmgr.GetOpts{
|
||||
Reserve: false,
|
||||
OffChain: false,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -55,7 +73,7 @@ func (a *PaychAPI) PaychNewPayment(ctx context.Context, from, to address.Address
|
||||
|
||||
// TODO: Fix free fund tracking in PaychGet
|
||||
// TODO: validate voucher spec before locking funds
|
||||
ch, err := a.PaychGet(ctx, from, to, amount)
|
||||
ch, err := a.PaychGet(ctx, from, to, amount, api.PaychGetOpts{OffChain: false})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+52
-2
@@ -391,6 +391,10 @@ func (sm *StorageMinerAPI) SectorMarkForUpgrade(ctx context.Context, id abi.Sect
|
||||
return sm.Miner.MarkForUpgrade(ctx, id, snap)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) SectorAbortUpgrade(ctx context.Context, number abi.SectorNumber) error {
|
||||
return sm.Miner.SectorAbortUpgrade(number)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) SectorCommitFlush(ctx context.Context) ([]sealiface.CommitBatchRes, error) {
|
||||
return sm.Miner.CommitFlush(ctx)
|
||||
}
|
||||
@@ -1004,6 +1008,52 @@ func (sm *StorageMinerAPI) DagstoreGC(ctx context.Context) ([]api.DagstoreShardR
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) IndexerAnnounceDeal(ctx context.Context, proposalCid cid.Cid) error {
|
||||
return sm.StorageProvider.AnnounceDealToIndexer(ctx, proposalCid)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) IndexerAnnounceAllDeals(ctx context.Context) error {
|
||||
return sm.StorageProvider.AnnounceAllDealsToIndexer(ctx)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) DagstoreLookupPieces(ctx context.Context, cid cid.Cid) ([]api.DagstoreShardInfo, error) {
|
||||
if sm.DAGStore == nil {
|
||||
return nil, fmt.Errorf("dagstore not available on this node")
|
||||
}
|
||||
|
||||
keys, err := sm.DAGStore.TopLevelIndex.GetShardsForMultihash(ctx, cid.Hash())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var ret []api.DagstoreShardInfo
|
||||
|
||||
for _, k := range keys {
|
||||
shard, err := sm.DAGStore.GetShardInfo(k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret = append(ret, api.DagstoreShardInfo{
|
||||
Key: k.String(),
|
||||
State: shard.ShardState.String(),
|
||||
Error: func() string {
|
||||
if shard.Error == nil {
|
||||
return ""
|
||||
}
|
||||
return shard.Error.Error()
|
||||
}(),
|
||||
})
|
||||
}
|
||||
|
||||
// order by key.
|
||||
sort.SliceStable(ret, func(i, j int) bool {
|
||||
return ret[i].Key < ret[j].Key
|
||||
})
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) DealsList(ctx context.Context) ([]api.MarketDeal, error) {
|
||||
return sm.listDeals(ctx)
|
||||
}
|
||||
@@ -1123,7 +1173,7 @@ func (sm *StorageMinerAPI) CreateBackup(ctx context.Context, fpath string) error
|
||||
return backup(ctx, sm.DS, fpath)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []sto.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) {
|
||||
func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []sto.SectorRef, update []bool, expensive bool) (map[abi.SectorNumber]string, error) {
|
||||
var rg storiface.RGetter
|
||||
if expensive {
|
||||
rg = func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
||||
@@ -1139,7 +1189,7 @@ func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredP
|
||||
}
|
||||
}
|
||||
|
||||
bad, err := sm.StorageMgr.CheckProvable(ctx, pp, sectors, rg)
|
||||
bad, err := sm.StorageMgr.CheckProvable(ctx, pp, sectors, update, rg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user