Пример #1
0
    def validate(self, transaction: SignedTransactionAPI) -> None:
        transaction_class = self.get_appropriate_tx_class()
        tx = transaction_class(**transaction.as_dict())
        tx.validate()

        if tx.chain_id != self.chain.chain_id:
            raise ValidationError(
                f"Transaction {encode_hex(tx.hash)} is for chain with id {tx.chain_id} "
                f"but current chain has id {self.chain.chain_id}")
Пример #2
0
    def __call__(self, transaction: SignedTransactionAPI) -> bool:

        transaction_class = self.get_appropriate_tx_class()
        tx = transaction_class(**transaction.as_dict())
        try:
            tx.validate()
        except ValidationError:
            return False
        else:
            return True