fix bug with early takeover by an update

This commit is contained in:
Jack Robison 2021-09-27 19:36:32 -04:00 committed by Victor Shyba
parent 65e39b8e76
commit 88e8926a59

View file

@ -1044,13 +1044,20 @@ class BlockProcessor:
activation = self.db.get_activation(tx_num, position) activation = self.db.get_activation(tx_num, position)
else: else:
tx_num, position = self.claim_hash_to_txo[winning_including_future_activations] tx_num, position = self.claim_hash_to_txo[winning_including_future_activations]
amount = None amount = self.txo_to_claim[(tx_num, position)].amount
activation = None activation = None
for (k, tx_amount) in activate_in_future[name][winning_including_future_activations]: for (k, tx_amount) in activate_in_future[name][winning_including_future_activations]:
if (k.tx_num, k.position) == (tx_num, position): if (k.tx_num, k.position) == (tx_num, position):
amount = tx_amount
activation = k.height activation = k.height
break break
if activation is None:
# TODO: reproduce this in an integration test (block 604718)
_k = PendingActivationValue(winning_including_future_activations, name)
if _k in activated_at_height:
for pending_activation in activated_at_height[_k]:
if (pending_activation.tx_num, pending_activation.position) == (tx_num, position):
activation = pending_activation.height
break
assert None not in (amount, activation) assert None not in (amount, activation)
# update the claim that's activating early # update the claim that's activating early
self.db_op_stack.extend_ops( self.db_op_stack.extend_ops(