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

race condition between claimReward() and opening a channel again? #367

Closed
pirapira opened this issue Dec 6, 2018 · 2 comments
Closed

race condition between claimReward() and opening a channel again? #367

pirapira opened this issue Dec 6, 2018 · 2 comments

Comments

@pirapira
Copy link
Contributor

pirapira commented Dec 6, 2018

claimReward() works only when the TokenNetwork contract has no ChannelState between the two participants.

So if I don't want to pay a MS, I can call TokenNetwork openChannel(me, partner, something) before the MS calls claimReward(). Then claimReward() will see Openned, and the MS won't get the reward. Is this correct?

@loredanacirstea
Copy link
Contributor

loredanacirstea commented Dec 6, 2018

This is because the MS contract is outdated. This PR #360 should fix the issue, as it also references the channel_identifier. This makes the distinction between the old and new channel:

        TokenNetwork.ChannelState channel_state;
        (, channel_state) = token_network.getChannelInfo(
            channel_identifier,
            closing_participant,
            non_closing_participant
        );

@pirapira
Copy link
Contributor Author

pirapira commented Dec 6, 2018

I see, and I agree.

@pirapira pirapira closed this as completed Dec 6, 2018
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

No branches or pull requests

2 participants