fixing miner logic to make more tests pass

This commit is contained in:
whyrusleeping
2020-02-28 11:31:28 -08:00
parent 2a1253e45a
commit 0945d8725e
17 changed files with 78 additions and 37 deletions
+7 -1
View File
@@ -300,6 +300,10 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
order.MinerPeerID = pid
}
if order.Size == 0 {
return xerrors.Errorf("cannot make retrieval deal for zero bytes")
}
retrievalResult := make(chan error, 1)
unsubscribe := a.Retrieval.SubscribeToEvents(func(event retrievalmarket.ClientEvent, state retrievalmarket.ClientDealState) {
@@ -313,10 +317,12 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
}
})
ppb := types.BigDiv(order.Total, types.NewInt(order.Size))
a.Retrieval.Retrieve(
ctx,
order.Root,
retrievalmarket.NewParamsV0(types.BigDiv(order.Total, types.NewInt(order.Size)), order.PaymentInterval, order.PaymentIntervalIncrease),
retrievalmarket.NewParamsV0(ppb, order.PaymentInterval, order.PaymentIntervalIncrease),
order.Total,
order.MinerPeerID,
order.Client,
+2 -2
View File
@@ -16,6 +16,6 @@ type MarketAPI struct {
FMgr *market.FundMgr
}
func (a *MarketAPI) MarketEnsureAvailable(ctx context.Context, addr address.Address, amt types.BigInt) error {
return a.FMgr.EnsureAvailable(ctx, addr, amt)
func (a *MarketAPI) MarketEnsureAvailable(ctx context.Context, addr, wallet address.Address, amt types.BigInt) error {
return a.FMgr.EnsureAvailable(ctx, addr, wallet, amt)
}