From a9c98eab8d046f6b18eed0c08ca0c8193407171b Mon Sep 17 00:00:00 2001 From: shannonwells Date: Mon, 20 Apr 2020 14:44:27 -0700 Subject: [PATCH] call paychmgr wait funcs, make sure tests are passing --- go.sum | 2 -- markets/retrievaladapter/client.go | 8 +++++--- paychmgr/simple.go | 7 +++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/go.sum b/go.sum index 8e4dbf5ff..31f93745d 100644 --- a/go.sum +++ b/go.sum @@ -147,8 +147,6 @@ github.com/filecoin-project/go-data-transfer v0.0.0-20200408061858-82c58b423ca6/ 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-markets v0.0.0-20200114015428-74d100f305f8/go.mod h1:c8NTjvFVy1Ud02mmGDjOiMeawY2t6ALfrrdvAB01FQc= -github.com/filecoin-project/go-fil-markets v0.0.0-20200413201123-731e6ca89984 h1:QY5jgd5T4txUEC2k9BPqWRlhDUTdFx5f1z/StOlh92g= -github.com/filecoin-project/go-fil-markets v0.0.0-20200413201123-731e6ca89984/go.mod h1:vcX3y5FVyuclIZgogPG1uIvJxHLSBU54B1ANJ88uMNk= github.com/filecoin-project/go-fil-markets v0.0.0-20200415011556-4378bd41b91f h1:mPmWWrEwc/5zZW2E14m8a7HMrrOWREaflGZL1Iun/Aw= github.com/filecoin-project/go-fil-markets v0.0.0-20200415011556-4378bd41b91f/go.mod h1:vcX3y5FVyuclIZgogPG1uIvJxHLSBU54B1ANJ88uMNk= github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 h1:92PET+sx1Hb4W/8CgFwGuxaKbttwY+UNspYZTvXY0vs= diff --git a/markets/retrievaladapter/client.go b/markets/retrievaladapter/client.go index 4b8982c43..61eca972f 100644 --- a/markets/retrievaladapter/client.go +++ b/markets/retrievaladapter/client.go @@ -65,11 +65,13 @@ func (rcn *retrievalClientNode) GetChainHead(ctx context.Context) (shared.TipSet return head.Key().Bytes(), head.Height(), nil } +// WaitForPaymentChannelAddFunds waits for messageCID to appear on chain. func (rcn *retrievalClientNode) WaitForPaymentChannelAddFunds(messageCID cid.Cid) error { - panic("implement me") + return rcn.pmgr.WaitForAddFundsMsg(context.TODO(), messageCID) } +// WaitForPaymentChannelCreation waits for messageCID to appear on chain and returns +// the address of the payment channel func (rcn *retrievalClientNode) WaitForPaymentChannelCreation(messageCID cid.Cid) (address.Address, error) { - panic("implement me") + return rcn.pmgr.WaitForPaychCreateMsg(context.TODO(), messageCID) } - diff --git a/paychmgr/simple.go b/paychmgr/simple.go index 92323abf9..c61bb9ee2 100644 --- a/paychmgr/simple.go +++ b/paychmgr/simple.go @@ -49,7 +49,9 @@ func (pm *Manager) createPaych(ctx context.Context, from, to address.Address, am return smsg.Cid(), nil } -func (pm *Manager) waitForPaychCreateMsg(ctx context.Context, mcid cid.Cid) (address.Address, error) { +// WaitForPaychCreateMsg waits for mcid to appear on chain and returns the robust address of the +// created payment channel +func (pm *Manager) WaitForPaychCreateMsg(ctx context.Context, mcid cid.Cid) (address.Address, error) { mwait, err := pm.state.StateWaitMsg(ctx, mcid) if err != nil { return address.Undef, xerrors.Errorf("wait msg: %w", err) @@ -95,7 +97,8 @@ func (pm *Manager) addFunds(ctx context.Context, ch address.Address, from addres return smsg.Cid(), nil } -func (pm *Manager) waitForAddFundsMsg(ctx context.Context, mcid cid.Cid) error { +// WaitForAddFundsMsg waits for mcid to appear on chain and returns error, if any +func (pm *Manager) WaitForAddFundsMsg(ctx context.Context, mcid cid.Cid) error { mwait, err := pm.state.StateWaitMsg(ctx, mcid) // TODO: wait outside the store lock! if err != nil {