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

Fix UnlockPartialProofState lockhash attribute #2795

Merged

Conversation

konradkonrad
Copy link
Contributor

This class was missing the lockhash attribute in order to be used like
any other lock state object.

Fixes #2794

This class was missing the `lockhash` attribute in order to be used like
any other lock state object.

Fixes raiden-network#2794
Copy link
Contributor

@palango palango left a comment

Choose a reason for hiding this comment

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

Yes, the problem stems from this code:

lock = channel_state.partner_state.secrethashes_to_lockedlocks.get(secrethash)
# If the lock was not found in locked locks, this means that we've received
# the secret for the locked transfer but we haven't unlocked it yet. Lock
# expiry in this case could still happen which means that we have to make
# sure that we check for "unclaimed" locks in our check.
if not lock:
lock = channel_state.partner_state.secrethashes_to_unlockedlocks.get(secrethash)
lock_registered_on_chain = (
secrethash in channel_state.our_state.secrethashes_to_onchain_unlockedlocks
)
if not lock:
msg = (
f'Invalid LockExpired message. '
f'Lock with secrethash {pex(secrethash)} is not known.'
)
return (False, msg, None)
current_balance_proof = get_current_balanceproof(sender_state)
merkletree = compute_merkletree_without(sender_state.merkletree, lock.lockhash)

This is actually reported by mypy:

raiden/transfer/channel.py:479: error: Incompatible types in assignment (expression has type "UnlockPartialProofState", variable has type "HashTimeLockState")

@konradkonrad konradkonrad merged commit d0cd7fb into raiden-network:master Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants