fix duplicate update op for early activating claim

This commit is contained in:
Jack Robison 2021-05-26 17:38:18 -04:00 committed by Victor Shyba
parent c0e2d56f55
commit 8711ece274

View file

@ -845,8 +845,6 @@ class BlockProcessor:
winning_including_future_activations = max( winning_including_future_activations = max(
amounts_with_future_activations, key=lambda x: amounts_with_future_activations[x] amounts_with_future_activations, key=lambda x: amounts_with_future_activations[x]
) )
print(amounts_with_future_activations)
print(amounts)
if winning_claim_hash != winning_including_future_activations: if winning_claim_hash != winning_including_future_activations:
print(f"\ttakeover of {name} by {winning_claim_hash.hex()} triggered early activation and " print(f"\ttakeover of {name} by {winning_claim_hash.hex()} triggered early activation and "
f"takeover by {winning_including_future_activations.hex()} at {height}") f"takeover by {winning_including_future_activations.hex()} at {height}")
@ -866,7 +864,9 @@ class BlockProcessor:
if (k.tx_num, k.position) == (tx_num, position): if (k.tx_num, k.position) == (tx_num, position):
amount = tx_amount amount = tx_amount
activation = k.height activation = k.height
break
assert None not in (amount, activation) assert None not in (amount, activation)
# update the claim that's activating early
ops.extend( ops.extend(
StagedActivation( StagedActivation(
ACTIVATED_CLAIM_TXO_TYPE, winning_including_future_activations, tx_num, ACTIVATED_CLAIM_TXO_TYPE, winning_including_future_activations, tx_num,
@ -879,26 +879,22 @@ class BlockProcessor:
position, height, name, amount position, height, name, amount
).get_activate_ops() ).get_activate_ops()
) )
for (k, amount) in activate_in_future[name][winning_including_future_activations]: for (k, amount) in activate_in_future[name][winning_including_future_activations]:
txo = (k.tx_num, k.position) txo = (k.tx_num, k.position)
if txo in self.possible_future_support_txos[winning_including_future_activations]: if txo in self.possible_future_support_txos[winning_including_future_activations]:
t = ACTIVATED_SUPPORT_TXO_TYPE t = ACTIVATED_SUPPORT_TXO_TYPE
else: ops.extend(
t = ACTIVATED_CLAIM_TXO_TYPE StagedActivation(
ops.extend( t, winning_including_future_activations, k.tx_num,
StagedActivation( k.position, k.height, name, amount
t, winning_including_future_activations, k.tx_num, ).get_remove_activate_ops()
k.position, k.height, name, amount )
).get_remove_activate_ops() ops.extend(
) StagedActivation(
ops.extend( t, winning_including_future_activations, k.tx_num,
StagedActivation( k.position, height, name, amount
t, winning_including_future_activations, k.tx_num, ).get_activate_ops()
k.position, height, name, amount )
).get_activate_ops()
)
ops.extend(get_takeover_name_ops(name, winning_including_future_activations, height, controlling)) ops.extend(get_takeover_name_ops(name, winning_including_future_activations, height, controlling))
elif not controlling or (winning_claim_hash != controlling.claim_hash and elif not controlling or (winning_claim_hash != controlling.claim_hash and
name in names_with_abandoned_controlling_claims) or \ name in names_with_abandoned_controlling_claims) or \