wallet server channel key change error

This commit is contained in:
Lex Berezhny 2019-05-25 23:50:37 -04:00
parent 29bd936181
commit 42dc0eccd6
2 changed files with 3 additions and 3 deletions

View file

@ -384,7 +384,7 @@ class SQLDB:
changed_channel_keys = {}
for claim_hash, new_key in new_channel_keys.items():
if all_channel_keys[claim_hash] != new_key:
if claim_hash not in all_channel_keys or all_channel_keys[claim_hash] != new_key:
all_channel_keys[claim_hash] = new_key
changed_channel_keys[claim_hash] = new_key

View file

@ -370,7 +370,7 @@ class TestSQLDB(unittest.TestCase):
self.assertEqual("@foo#a/foo#ab", r_ab2['canonical_url'])
self.assertEqual(2, self.sql._search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
# invalidate channel signature
# change channel public key, invaliding stream claim signatures
advance(8, [self.get_channel_update(txo_chan_a, COIN, key=b'a')])
r_ab2, r_a2 = self.sql._search(order_by=['creation_height'], limit=2)
self.assertEqual(f"foo#{a2_claim_id[:2]}", r_a2['short_url'])
@ -379,7 +379,7 @@ class TestSQLDB(unittest.TestCase):
self.assertIsNone(r_ab2['canonical_url'])
self.assertEqual(0, self.sql._search(claim_id=txo_chan_a.claim_id, limit=1)[0]['claims_in_channel'])
# re-validate signature (reverts signature to original one)
# reinstate previous channel public key (previous stream claim signatures become valid again)
advance(9, [self.get_channel_update(txo_chan_a, COIN, key=b'c')])
r_ab2, r_a2 = self.sql._search(order_by=['creation_height'], limit=2)
self.assertEqual(f"foo#{a2_claim_id[:2]}", r_a2['short_url'])