From 2ba044ee4eb6ec7c8725433f7b9e54283aa99986 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 25 May 2021 18:42:08 -0400 Subject: [PATCH] require previous_winning arg for get_takeover_name_ops --- lbry/wallet/server/block_processor.py | 7 +++---- lbry/wallet/server/db/claimtrie.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index af71e386e..2f023d30f 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -833,7 +833,7 @@ class BlockProcessor: k.position, height, name, amount ).get_activate_ops() ) - ops.extend(get_takeover_name_ops(name, winning_including_future_activations, height)) + ops.extend(get_takeover_name_ops(name, winning_including_future_activations, height, controlling)) elif not controlling or (winning_claim_hash != controlling.claim_hash and name in names_with_abandoned_controlling_claims) or \ ((winning_claim_hash != controlling.claim_hash) and (amounts[winning_claim_hash] > amounts[controlling.claim_hash])): @@ -862,7 +862,7 @@ class BlockProcessor: position, height, name, amount ).get_activate_ops() ) - ops.extend(get_takeover_name_ops(name, winning_claim_hash, height)) + ops.extend(get_takeover_name_ops(name, winning_claim_hash, height, controlling)) elif winning_claim_hash == controlling.claim_hash: print("\tstill winning") pass @@ -887,8 +887,7 @@ class BlockProcessor: winning = max(amounts, key=lambda x: amounts[x]) if (controlling and winning != controlling.claim_hash) or (not controlling and winning): print(f"\ttakeover from abandoned support {controlling.claim_hash.hex()} -> {winning.hex()}") - ops.extend(get_takeover_name_ops(name, winning, height)) - + ops.extend(get_takeover_name_ops(name, winning, height, controlling)) return ops def advance_block(self, block): diff --git a/lbry/wallet/server/db/claimtrie.py b/lbry/wallet/server/db/claimtrie.py index 42bcb9077..481e2178c 100644 --- a/lbry/wallet/server/db/claimtrie.py +++ b/lbry/wallet/server/db/claimtrie.py @@ -89,7 +89,7 @@ def get_remove_name_ops(name: str, claim_hash: bytes, height: int) -> typing.Lis def get_takeover_name_ops(name: str, claim_hash: bytes, takeover_height: int, - previous_winning: Optional[ClaimTakeoverValue] = None): + previous_winning: Optional[ClaimTakeoverValue]): if previous_winning: return [ RevertableDelete(