Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions hathor/nanocontracts/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ def get_caller_contract_id(self) -> ContractId | None:
case _: # pragma: no cover
assert_never(self.caller_id)

@property
def timestamp(self) -> int:
"""
Get the timestamp of the block executing the nano transaction.
DEPRECATED: Use `ctx.block.timestamp` instead.
"""
return self.block.timestamp

@property
def actions(self) -> MappingProxyType[TokenUid, tuple[NCAction, ...]]:
"""Get a mapping of actions per token."""
Expand Down
6 changes: 5 additions & 1 deletion hathor/nanocontracts/resources/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from hathor.nanocontracts import types as nc_types
from hathor.nanocontracts.blueprint import NC_FIELDS_ATTR
from hathor.nanocontracts.context import Context
from hathor.nanocontracts.exception import BlueprintDoesNotExist
from hathor.nanocontracts.exception import BlueprintDoesNotExist, OCBBlueprintNotConfirmed
from hathor.nanocontracts.types import blueprint_id_from_bytes
from hathor.nanocontracts.utils import is_nc_public_method, is_nc_view_method
from hathor.utils.api import ErrorResponse, QueryParams, Response
Expand Down Expand Up @@ -94,6 +94,10 @@ def render_GET(self, request: 'Request') -> bytes:
request.setResponseCode(404)
error_response = ErrorResponse(success=False, error=f'Blueprint not found: {params.blueprint_id}')
return error_response.json_dumpb()
except OCBBlueprintNotConfirmed:
request.setResponseCode(404)
error_response = ErrorResponse(success=False, error=f'Blueprint found but not confirmed: {params.blueprint_id}')
return error_response.json_dumpb()

attributes: dict[str, str] = {}
fields = getattr(blueprint_class, NC_FIELDS_ATTR)
Expand Down
1 change: 0 additions & 1 deletion tests/nanocontracts/test_exposed_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
'hathor.nanocontracts.context.Context.get_caller_contract_id',
'hathor.nanocontracts.context.Context.get_single_action',
'hathor.nanocontracts.context.Context.some_new_attribute',
'hathor.nanocontracts.context.Context.timestamp',
'hathor.nanocontracts.context.Context.to_json',
'hathor.nanocontracts.context.Context.vertex',
'hathor.nanocontracts.exception.NCFail.add_note',
Expand Down
Loading