deals: Sending initial proposal works
This commit is contained in:
committed by
whyrusleeping
parent
322031d8e4
commit
b65041cac1
@@ -73,6 +73,7 @@ const (
|
||||
HandleIncomingMessagesKey
|
||||
|
||||
RunDealClientKey
|
||||
HandleDealsKey
|
||||
|
||||
// daemon
|
||||
ExtractApiKey
|
||||
@@ -219,6 +220,9 @@ func Online() Option {
|
||||
ApplyIf(func(s *Settings) bool { return s.nodeType == nodeStorageMiner },
|
||||
Override(new(*sectorbuilder.SectorBuilder), modules.SectorBuilder),
|
||||
Override(new(*storage.Miner), modules.StorageMiner),
|
||||
|
||||
Override(new(*deals.Handler), deals.NewHandler),
|
||||
Override(HandleDealsKey, modules.HandleDeals),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
+9
-2
@@ -44,9 +44,14 @@ type FullNodeAPI struct {
|
||||
}
|
||||
|
||||
func (a *FullNodeAPI) ClientStartDeal(ctx context.Context, data cid.Cid, miner address.Address, blocksDuration uint64) error {
|
||||
self, err := a.WalletDefaultAddress(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg := &types.Message{
|
||||
To: miner,
|
||||
From: miner, // TODO: we need /something/ here, but this smells
|
||||
From: miner,
|
||||
Method: actors.MAMethods.GetPeerID,
|
||||
}
|
||||
|
||||
@@ -59,7 +64,9 @@ func (a *FullNodeAPI) ClientStartDeal(ctx context.Context, data cid.Cid, miner a
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = a.DealClient.Start(ctx, data, miner, pid, blocksDuration)
|
||||
price := types.NewInt(10 * blocksDuration) // TODO: allow to actually specify this
|
||||
|
||||
_, err = a.DealClient.Start(ctx, data, price, self, miner, pid, blocksDuration)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/chain/address"
|
||||
"github.com/filecoin-project/go-lotus/chain/deals"
|
||||
"github.com/filecoin-project/go-lotus/chain/wallet"
|
||||
"github.com/filecoin-project/go-lotus/lib/sectorbuilder"
|
||||
"github.com/filecoin-project/go-lotus/node/modules/dtypes"
|
||||
@@ -94,3 +95,7 @@ func StorageMiner(mctx helpers.MetricsCtx, lc fx.Lifecycle, api api.FullNode, h
|
||||
|
||||
return sm, nil
|
||||
}
|
||||
|
||||
func HandleDeals(h host.Host, handler *deals.Handler) {
|
||||
h.SetStreamHandler(deals.ProtocolID, handler.HandleStream)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user