require previous_winning arg for get_takeover_name_ops

This commit is contained in:
Jack Robison 2021-05-25 18:42:08 -04:00 committed by Victor Shyba
parent d69180da71
commit 2ba044ee4e
2 changed files with 4 additions and 5 deletions

View file

@ -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):

View file

@ -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(