diff --git a/lbrynet/schema/compat.py b/lbrynet/schema/compat.py index 0691bfc1e..127b32d0a 100644 --- a/lbrynet/schema/compat.py +++ b/lbrynet/schema/compat.py @@ -77,7 +77,7 @@ def from_types_v1(claim, payload: bytes): sig = old.publisherSignature claim.signature = sig.signature claim.signature_type = KeyType.Name(sig.signatureType) - claim.signing_channel_hash = sig.certificateId + claim.signing_channel_hash = sig.certificateId[::-1] old.ClearField("publisherSignature") claim.unsigned_payload = old.SerializeToString() elif old.claimType == 2: diff --git a/lbrynet/wallet/transaction.py b/lbrynet/wallet/transaction.py index ddad6d777..58c98e78e 100644 --- a/lbrynet/wallet/transaction.py +++ b/lbrynet/wallet/transaction.py @@ -98,7 +98,7 @@ class Output(BaseOutput): pieces = [ Base58.decode(self.get_address(ledger)), self.claim.unsigned_payload, - self.claim.signing_channel_hash + self.claim.signing_channel_hash[::-1] ] else: pieces = [ diff --git a/tests/integration/test_claim_commands.py b/tests/integration/test_claim_commands.py index 7284d09c3..3bdf6a4a9 100644 --- a/tests/integration/test_claim_commands.py +++ b/tests/integration/test_claim_commands.py @@ -591,7 +591,7 @@ class StreamCommands(CommandTestCase): channel = await self.daemon.jsonrpc_channel_create('@olds', '1.0') await self.confirm_tx(channel.id) address = channel.outputs[0].get_address(self.account.ledger) - claim = generate_signed_legacy('example', address, channel.outputs[0]) + claim = generate_signed_legacy(address, channel.outputs[0]) tx = await Transaction.claim_create('example', claim.SerializeToString(), 1, address, [self.account], self.account) await tx.sign([self.account]) await self.broadcast(tx) @@ -609,12 +609,12 @@ class StreamCommands(CommandTestCase): await self.confirm_tx(tx.id) response = await self.daemon.jsonrpc_resolve(urls='bad_example') - self.assertFalse(response['bad_example']['claim']['signature_is_valid'], response) + self.assertIs(False, response['bad_example']['claim']['signature_is_valid'], response) response = await self.daemon.jsonrpc_resolve(urls='@olds/bad_example') self.assertEqual('URI lbry://@olds/bad_example cannot be resolved', response['@olds/bad_example']['error']) -def generate_signed_legacy(name: str, address: bytes, output: Output): +def generate_signed_legacy(address: bytes, output: Output): decoded_address = Base58.decode(address) claim = OldClaimMessage() claim.ParseFromString(unhexlify( @@ -640,14 +640,14 @@ def generate_signed_legacy(name: str, address: bytes, output: Output): digest = sha256(b''.join([ decoded_address, claim.SerializeToString(), - output.claim_hash + output.claim_hash[::-1] ])) private_key = ecdsa.SigningKey.from_pem(output.private_key, hashfunc=hashlib.sha256) signature = private_key.sign_digest_deterministic(digest, hashfunc=hashlib.sha256) claim.publisherSignature.version = 1 claim.publisherSignature.signatureType = 1 claim.publisherSignature.signature = signature - claim.publisherSignature.certificateId = output.claim_hash + claim.publisherSignature.certificateId = output.claim_hash[::-1] return claim