Skip to content

ChannelStateSchema.get_balance returns distributable #4348

@karlb

Description

@karlb

According to the glossary, the capacity does not care about locks:

A channel's capacity is the sum of the total deposits minus the sum of the total withdraws of both its participants

while the term "distributable" does:

distributable = get_balance(sender, receiver) - get_amount_locked(sender)

Since these two terms mean different things, the following code is wrong or at least highly misleading:

class ChannelStateSchema(BaseSchema):

    ...

    @staticmethod
    def get_balance(channel_state):
        return channel.get_distributable(channel_state.our_state, channel_state.partner_state)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions