From 77adcaeb5048f2f63edf643a3e7ccc3d81f7010d Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Tue, 2 Jul 2019 11:58:24 -0400 Subject: [PATCH] Fixes corner case where channel is pending confirmation --- lbry/lbry/extras/daemon/comment_client.py | 27 ++++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lbry/lbry/extras/daemon/comment_client.py b/lbry/lbry/extras/daemon/comment_client.py index 9d1c7f2a4..32582fdf7 100644 --- a/lbry/lbry/extras/daemon/comment_client.py +++ b/lbry/lbry/extras/daemon/comment_client.py @@ -19,19 +19,20 @@ def get_encoded_signature(signature): def is_comment_signed_by_channel(comment: dict, channel: Output): - try: - pieces = [ - comment['signing_ts'].encode(), - channel.claim_hash, - comment['comment'].encode() - ] - return Output.is_signature_valid( - get_encoded_signature(comment['signature']), - sha256(b''.join(pieces)), - channel.claim.channel.public_key_bytes - ) - except KeyError: - pass + if type(channel) is Output: + try: + pieces = [ + comment['signing_ts'].encode(), + channel.claim_hash, + comment['comment'].encode() + ] + return Output.is_signature_valid( + get_encoded_signature(comment['signature']), + sha256(b''.join(pieces)), + channel.claim.channel.public_key_bytes + ) + except KeyError: + pass return False