5b74a71dd3
Define all types to spec, modify interfaces, wrap old code fix(builder): use client blockstore for retrieval feat(retrieval): add node implementations add node adapters for client & provider so that retrieval can be extracted
24 lines
816 B
Go
24 lines
816 B
Go
package retrievaladapter
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/filecoin-project/lotus/api"
|
|
"github.com/filecoin-project/go-address"
|
|
retrievalmarket "github.com/filecoin-project/lotus/retrieval"
|
|
)
|
|
|
|
type retrievalProviderNode struct {
|
|
full api.FullNode
|
|
}
|
|
|
|
// NewRetrievalProviderNode returns a new node adapter for a retrieval provider that talks to the
|
|
// Lotus Node
|
|
func NewRetrievalProviderNode(full api.FullNode) retrievalmarket.RetrievalProviderNode {
|
|
return &retrievalProviderNode{full}
|
|
}
|
|
|
|
func (rpn *retrievalProviderNode) SavePaymentVoucher(ctx context.Context, paymentChannel address.Address, voucher *retrievalmarket.SignedVoucher, proof []byte, expectedAmount retrievalmarket.BigInt) (retrievalmarket.BigInt, error) {
|
|
return rpn.full.PaychVoucherAdd(ctx, paymentChannel, voucher, proof, expectedAmount)
|
|
}
|