From 33e8ef75ff9c52531302369a42b8b679cf335d5d Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 27 Sep 2021 19:36:32 -0400 Subject: [PATCH] fix bug with early takeover by an update --- lbry/wallet/server/block_processor.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index 907e0d8e2..fb2b1eda8 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -1044,13 +1044,20 @@ class BlockProcessor: activation = self.db.get_activation(tx_num, position) else: 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 for (k, tx_amount) in activate_in_future[name][winning_including_future_activations]: if (k.tx_num, k.position) == (tx_num, position): - amount = tx_amount activation = k.height 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) # update the claim that's activating early self.db_op_stack.extend_ops(