Skip to content

Commit eec2ff0

Browse files
committed
review changes
1 parent 5b40f8a commit eec2ff0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

hathor/consensus/consensus.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
from hathor.consensus.transaction_consensus import TransactionConsensusAlgorithmFactory
2525
from hathor.execution_manager import non_critical_code
2626
from hathor.feature_activation.feature import Feature
27+
from hathor.nanocontracts.exception import NCInvalidSignature
2728
from hathor.nanocontracts.execution import NCBlockExecutor
2829
from hathor.profiler import get_cpu_profiler
2930
from hathor.pubsub import HathorEvents, PubSubManager
3031
from hathor.transaction import BaseTransaction, Block, Transaction
31-
from hathor.transaction.exceptions import RewardLocked
32+
from hathor.transaction.exceptions import InvalidInputData, RewardLocked, TooManySigOps
3233
from hathor.util import not_none
3334
from hathor.verification.verification_params import VerificationParams
3435

@@ -495,7 +496,9 @@ def _checkdatasig_count_rule(self, tx: Transaction) -> bool:
495496
# a fail and the tx will be removed from the mempool.
496497
try:
497498
VertexVerifier._verify_sigops_output(settings=self._settings, vertex=tx, enable_checkdatasig_count=True)
498-
except Exception:
499+
except Exception as e:
500+
if not isinstance(e, TooManySigOps):
501+
self.log.exception('unexpected exception in mempool-reverification')
499502
return False
500503
return True
501504

@@ -513,15 +516,19 @@ def _opcodes_v2_activation_rule(self, tx: Transaction, new_best_block: Block) ->
513516
# a fail and the tx will be removed from the mempool.
514517
try:
515518
TransactionVerifier._verify_inputs(self._settings, tx, params, skip_script=False)
516-
except Exception:
519+
except Exception as e:
520+
if not isinstance(e, InvalidInputData):
521+
self.log.exception('unexpected exception in mempool-reverification')
517522
return False
518523

519524
# Any exception in the nc_signature verification will be considered
520525
# a fail and the tx will be removed from the mempool.
521526
if tx.is_nano_contract():
522527
try:
523528
NanoHeaderVerifier._verify_nc_signature(self._settings, tx, params)
524-
except Exception:
529+
except Exception as e:
530+
if not isinstance(e, NCInvalidSignature):
531+
self.log.exception('unexpected exception in mempool-reverification')
525532
return False
526533

527534
return True

0 commit comments

Comments
 (0)