fix(paychmr): decode address correctly, pass wallet

This commit is contained in:
hannahhoward 2020-02-28 19:23:55 -08:00
parent 0d7afef0c5
commit bda5315866
4 changed files with 12 additions and 2 deletions

1
go.sum
View File

@ -112,6 +112,7 @@ github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww=
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5 h1:yvQJCW9mmi9zy+51xA01Ea2X7/dL7r8eKDPuGUjRmbo=
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5/go.mod h1:JbkIgFF/Z9BDlvrJO1FuKkaWsH673/UdFaiVS6uIHlA=
github.com/filecoin-project/go-fil-components v0.0.0-20200228192824-ee51014cc8c6 h1:GJTFEqi4HllM3MMSh4Q4oF1d7/sFkp05vd/f499BlJQ=
github.com/filecoin-project/go-fil-markets v0.0.0-20200228192824-ee51014cc8c6 h1:xYldVV9fZ+nsykQnEVMwcLU+6R5EshzmOWcyQDpludc=
github.com/filecoin-project/go-fil-markets v0.0.0-20200228192824-ee51014cc8c6/go.mod h1:rfRwhd3ujcCXnD4N9oEM2wjh8GRZGoeNXME+UPG/9ts=
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 h1:92PET+sx1Hb4W/8CgFwGuxaKbttwY+UNspYZTvXY0vs=

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/storage"
)
@ -26,6 +27,11 @@ func NewRetrievalProviderNode(miner *storage.Miner, sb sectorbuilder.Interface,
return &retrievalProviderNode{miner, sb, full}
}
func (rpn *retrievalProviderNode) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) {
addr, err := rpn.full.StateMinerWorker(ctx, miner, types.EmptyTSK)
return addr, err
}
func (rpn *retrievalProviderNode) UnsealSector(ctx context.Context, sectorID uint64, offset uint64, length uint64) (io.ReadCloser, error) {
si, err := rpn.miner.GetSectorInfo(abi.SectorNumber(sectorID))
if err != nil {

View File

@ -187,7 +187,7 @@ func (a *API) ClientFindData(ctx context.Context, root cid.Cid) ([]api.QueryOffe
MinPrice: queryResponse.PieceRetrievalPrice(),
PaymentInterval: queryResponse.MaxPaymentInterval,
PaymentIntervalIncrease: queryResponse.MaxPaymentIntervalIncrease,
Miner: p.Address, // TODO: check
Miner: queryResponse.PaymentAddress, // TODO: check
MinerPeerID: p.ID,
}
}

View File

@ -1,6 +1,7 @@
package paychmgr
import (
"bytes"
"context"
"fmt"
@ -58,10 +59,12 @@ func (pm *Manager) createPaych(ctx context.Context, from, to address.Address, am
return address.Undef, cid.Undef, fmt.Errorf("payment channel creation failed (exit code %d)", mwait.Receipt.ExitCode)
}
paychaddr, err := address.NewFromBytes(mwait.Receipt.Return)
var decodedReturn init_.ExecReturn
err = decodedReturn.UnmarshalCBOR(bytes.NewReader(mwait.Receipt.Return))
if err != nil {
return address.Undef, cid.Undef, err
}
paychaddr := decodedReturn.RobustAddress
ci, err := pm.loadOutboundChannelInfo(ctx, paychaddr)
if err != nil {