forked from LBRYCommunity/lbry-sdk
Fixes corner case where channel is pending confirmation
This commit is contained in:
parent
86b46ebf19
commit
77adcaeb50
1 changed files with 14 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue