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