deals: move PaymentInfo to paych actor
This commit is contained in:
parent
2114e8f555
commit
a664098867
@ -3,11 +3,12 @@ package actors
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/go-lotus/chain/address"
|
||||
"github.com/filecoin-project/go-lotus/chain/types"
|
||||
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
)
|
||||
|
||||
const ChannelClosingDelay = 6 * 60 * 2 // six hours
|
||||
@ -19,10 +20,19 @@ func init() {
|
||||
cbor.RegisterCborType(Merge{})
|
||||
cbor.RegisterCborType(LaneState{})
|
||||
cbor.RegisterCborType(UpdateChannelState{})
|
||||
cbor.RegisterCborType(PaymentInfo{})
|
||||
}
|
||||
|
||||
type PaymentChannelActor struct{}
|
||||
|
||||
type PaymentInfo struct {
|
||||
PayChActor address.Address
|
||||
Payer address.Address
|
||||
ChannelMessage cid.Cid
|
||||
|
||||
Vouchers []SignedVoucher
|
||||
}
|
||||
|
||||
type LaneState struct {
|
||||
Closed bool
|
||||
Redeemed types.BigInt
|
||||
|
@ -2,6 +2,7 @@ package deals
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/filecoin-project/go-lotus/chain/actors"
|
||||
"math"
|
||||
|
||||
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
||||
@ -198,7 +199,7 @@ func (c *Client) Start(ctx context.Context, data cid.Cid, totalPrice types.BigIn
|
||||
Size: uint64(size),
|
||||
TotalPrice: totalPrice,
|
||||
Duration: blocksDuration,
|
||||
Payment: PaymentInfo{
|
||||
Payment: actors.PaymentInfo{
|
||||
PayChActor: address.Address{},
|
||||
Payer: address.Address{},
|
||||
ChannelMessage: dummyCid,
|
||||
|
@ -86,6 +86,8 @@ func NewHandler(w *wallet.Wallet, ds dtypes.MetadataDS, sb *sectorbuilder.Sector
|
||||
}
|
||||
|
||||
func (h *Handler) Run(ctx context.Context) {
|
||||
// TODO: restore state
|
||||
|
||||
go func() {
|
||||
defer log.Error("quitting deal handler loop")
|
||||
defer close(h.stopped)
|
||||
|
@ -37,6 +37,8 @@ func (h *Handler) accept(ctx context.Context, deal MinerDeal) error {
|
||||
return xerrors.Errorf("deal proposal with unsupported serialization: %s", deal.Proposal.SerializationMode)
|
||||
}
|
||||
|
||||
// TODO: check payment
|
||||
|
||||
log.Info("fetching data for a deal")
|
||||
err := h.sendSignedResponse(StorageDealResponse{
|
||||
State: Accepted,
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
cbor.RegisterCborType(PaymentInfo{})
|
||||
cbor.RegisterCborType(StorageDealProposal{})
|
||||
cbor.RegisterCborType(SignedStorageDealProposal{})
|
||||
|
||||
@ -41,15 +40,6 @@ const (
|
||||
Complete
|
||||
)
|
||||
|
||||
// TODO: this should probably be in a separate package with other paych utils
|
||||
type PaymentInfo struct {
|
||||
PayChActor address.Address
|
||||
Payer address.Address
|
||||
ChannelMessage cid.Cid
|
||||
|
||||
Vouchers []actors.SignedVoucher
|
||||
}
|
||||
|
||||
type StorageDealProposal struct {
|
||||
PieceRef string
|
||||
SerializationMode SerializationMode
|
||||
@ -59,7 +49,7 @@ type StorageDealProposal struct {
|
||||
TotalPrice types.BigInt
|
||||
Duration uint64
|
||||
|
||||
Payment PaymentInfo
|
||||
Payment actors.PaymentInfo
|
||||
|
||||
MinerAddress address.Address
|
||||
ClientAddress address.Address
|
||||
|
Loading…
Reference in New Issue
Block a user