Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add funds to payment channel before allocating lane #495

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Feb 23, 2021

Before retrieving a file, the client must create a payment channel to pay for retrieval. Each deal has a separate lane in the payment channel that is used to manage funds for that particular deal.

The steps are:

  1. Create payment channel with funds on chain
  2. Wait for payment channel to be created
  3. Create a payment channel lane for the deal
  4. Transfer data

If a payment channel already exists in step 1, funds must be added to the existing channel. This PR fixes a bug where the retrieval market state machine would not wait for the add funds message to land on chain before continuing, which caused issues when creating vouchers against the payment channel.

@dirkmc dirkmc requested a review from nonsense February 23, 2021 10:40
From(rm.DealStatusPaymentChannelCreating).To(rm.DealStatusPaymentChannelAllocatingLane).
From(rm.DealStatusPaymentChannelAddingInitialFunds).To(rm.DealStatusPaymentChannelAllocatingLane).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused with naming here. Why Initial funds? If the payment channel existed and ran out of funds, wouldn't it be better to call it AddingMoreFunds?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is Initial, because this is adding funds for a new deal, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right exactly, the funds are for the new deal 👍

@dirkmc dirkmc merged commit f24d924 into master Feb 24, 2021
@dirkmc dirkmc deleted the fix/retrieval-paych-add-funds branch February 24, 2021 12:41
@dirkmc dirkmc mentioned this pull request Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants