forked from LBRYCommunity/lbry-sdk
fix bug when two updates for the same claim happened in the same block
This commit is contained in:
parent
8390482d6c
commit
f68bdc406f
2 changed files with 12 additions and 4 deletions
|
@ -718,8 +718,6 @@ class SQLDB:
|
||||||
claim_hash = output.claim_hash
|
claim_hash = output.claim_hash
|
||||||
update_claims.append(output)
|
update_claims.append(output)
|
||||||
recalculate_claim_hashes.add(claim_hash)
|
recalculate_claim_hashes.add(claim_hash)
|
||||||
delete_claim_hashes.discard(claim_hash)
|
|
||||||
update_claim_hashes.add(claim_hash)
|
|
||||||
body_timer.stop()
|
body_timer.stop()
|
||||||
|
|
||||||
skip_update_claim_timer = timer.add_timer('skip update of abandoned claims')
|
skip_update_claim_timer = timer.add_timer('skip update of abandoned claims')
|
||||||
|
@ -727,8 +725,10 @@ class SQLDB:
|
||||||
for updated_claim in list(update_claims):
|
for updated_claim in list(update_claims):
|
||||||
if updated_claim.ref.hash in delete_others:
|
if updated_claim.ref.hash in delete_others:
|
||||||
update_claims.remove(updated_claim)
|
update_claims.remove(updated_claim)
|
||||||
delete_claim_hashes.add(updated_claim.claim_hash)
|
for updated_claim in update_claims:
|
||||||
update_claim_hashes.discard(updated_claim.claim_hash)
|
claim_hash = updated_claim.claim_hash
|
||||||
|
delete_claim_hashes.discard(claim_hash)
|
||||||
|
update_claim_hashes.add(claim_hash)
|
||||||
skip_update_claim_timer.stop()
|
skip_update_claim_timer.stop()
|
||||||
|
|
||||||
skip_insert_claim_timer = timer.add_timer('skip insertion of abandoned claims')
|
skip_insert_claim_timer = timer.add_timer('skip insertion of abandoned claims')
|
||||||
|
|
|
@ -321,6 +321,14 @@ class TestClaimtrie(TestSQLDB):
|
||||||
advance(10, [stream, self.get_stream_update(stream, 11*COIN)])
|
advance(10, [stream, self.get_stream_update(stream, 11*COIN)])
|
||||||
self.assertTrue(reader._search())
|
self.assertTrue(reader._search())
|
||||||
|
|
||||||
|
def test_double_updates_in_same_block(self):
|
||||||
|
advance, state = self.advance, self.state
|
||||||
|
stream = self.get_stream('Claim A', 10*COIN)
|
||||||
|
advance(10, [stream])
|
||||||
|
update = self.get_stream_update(stream, 11*COIN)
|
||||||
|
advance(20, [update, self.get_stream_update(update, 9*COIN)])
|
||||||
|
self.assertTrue(reader._search())
|
||||||
|
|
||||||
def test_create_and_abandon_in_same_block(self):
|
def test_create_and_abandon_in_same_block(self):
|
||||||
advance, state = self.advance, self.state
|
advance, state = self.advance, self.state
|
||||||
stream = self.get_stream('Claim A', 10*COIN)
|
stream = self.get_stream('Claim A', 10*COIN)
|
||||||
|
|
Loading…
Reference in a new issue