mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-27 15:31:29 +00:00
test recover from invalid tokens
This commit is contained in:
parent
9f8d3e69ae
commit
7eb9f344f4
1 changed files with 25 additions and 0 deletions
|
@ -13,6 +13,31 @@ log = logging.getLogger()
|
||||||
class TestStoreExpiration(TestKademliaBase):
|
class TestStoreExpiration(TestKademliaBase):
|
||||||
network_size = 40
|
network_size = 40
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def test_nullify_token(self):
|
||||||
|
blob_hash = generate_id(1)
|
||||||
|
announcing_node = self.nodes[20]
|
||||||
|
# announce the blob
|
||||||
|
announce_d = announcing_node.announceHaveBlob(blob_hash)
|
||||||
|
self.pump_clock(5+1)
|
||||||
|
storing_node_ids = yield announce_d
|
||||||
|
self.assertEqual(len(storing_node_ids), 8)
|
||||||
|
|
||||||
|
for node in set(self.nodes).union(set(self._seeds)):
|
||||||
|
# now, everyone has the wrong token
|
||||||
|
node.change_token()
|
||||||
|
node.change_token()
|
||||||
|
|
||||||
|
announce_d = announcing_node.announceHaveBlob(blob_hash)
|
||||||
|
self.pump_clock(5+1)
|
||||||
|
storing_node_ids = yield announce_d
|
||||||
|
self.assertEqual(len(storing_node_ids), 0) # cant store, wrong tokens, but they get nullified
|
||||||
|
|
||||||
|
announce_d = announcing_node.announceHaveBlob(blob_hash)
|
||||||
|
self.pump_clock(5+1)
|
||||||
|
storing_node_ids = yield announce_d
|
||||||
|
self.assertEqual(len(storing_node_ids), 8) # next attempt succeeds as it refreshes tokens
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_store_and_expire(self):
|
def test_store_and_expire(self):
|
||||||
blob_hash = generate_id(1)
|
blob_hash = generate_id(1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue