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

paych: get available funds by address or by from/to #3547

Merged
merged 2 commits into from
Sep 5, 2020

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Sep 4, 2020

Previously we had a method to get available funds for a channel by from/to, which makes sense from CLI. However for markets non-blocking retrieval it makes more sense to get funds by channel address.
This PR adds a new API method to get available funds by channel address. So now there are two API methods to get available funds for a channel:

PaychAvailableFunds(ch address.Address) (*ChannelAvailableFunds, error)
PaychAvailableFundsByFromTo(from, to address.Address) (*ChannelAvailableFunds, error)

@@ -207,22 +207,23 @@ type FullNodeStruct struct {

MarketEnsureAvailable func(context.Context, address.Address, address.Address, types.BigInt) (cid.Cid, error) `perm:"sign"`

PaychGet func(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error) `perm:"sign"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just an indentation change

if err != nil {
return err
}

if avail.Channel == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logic of formatting the channel status output is the same, it's just been extracted into a method that's called by both paych status and paych status-by-from-to

}
}

func (ca *channelAccessor) currentAvailableFunds(queuedAmt types.BigInt) (*api.ChannelAvailableFunds, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the logic for what to do if the channel is not found into the manager layer

Copy link
Contributor

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

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

LGTM

@magik6k magik6k merged commit c767e5e into master Sep 5, 2020
@magik6k magik6k deleted the feat/paych-status-addr branch September 5, 2020 19:55
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.

3 participants