Merge pull request #2286 from osilkin98/2279-fix
Fixes corner case on comment validation for pending channel
This commit is contained in:
commit
4f208b6b31
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):
|
def is_comment_signed_by_channel(comment: dict, channel: Output):
|
||||||
try:
|
if type(channel) is Output:
|
||||||
pieces = [
|
try:
|
||||||
comment['signing_ts'].encode(),
|
pieces = [
|
||||||
channel.claim_hash,
|
comment['signing_ts'].encode(),
|
||||||
comment['comment'].encode()
|
channel.claim_hash,
|
||||||
]
|
comment['comment'].encode()
|
||||||
return Output.is_signature_valid(
|
]
|
||||||
get_encoded_signature(comment['signature']),
|
return Output.is_signature_valid(
|
||||||
sha256(b''.join(pieces)),
|
get_encoded_signature(comment['signature']),
|
||||||
channel.claim.channel.public_key_bytes
|
sha256(b''.join(pieces)),
|
||||||
)
|
channel.claim.channel.public_key_bytes
|
||||||
except KeyError:
|
)
|
||||||
pass
|
except KeyError:
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue