Skip to content

Commit

Permalink
remove backwards compat for v1
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Mar 7, 2024
1 parent dae1251 commit 30ee04a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
4 changes: 0 additions & 4 deletions cashu/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,6 @@ class PostSplitResponse_Very_Deprecated(BaseModel):

class PostCheckStateRequest(BaseModel):
Ys: List[str] = Field(..., max_items=settings.mint_max_request_length)
secrets: Optional[List[str]] = Field(
default=None, max_items=settings.mint_max_request_length
) # deprecated since 0.15.1


class SpentState(Enum):
Expand All @@ -505,7 +502,6 @@ class ProofState(BaseModel):
Y: str
state: SpentState
witness: Optional[str] = None
secret: Optional[str] = None # deprecated since 0.15.1


class PostCheckStateResponse(BaseModel):
Expand Down
19 changes: 0 additions & 19 deletions cashu/mint/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from fastapi import APIRouter
from loguru import logger

from cashu.core.crypto import b_dhke

from ..core.base import (
GetInfoResponse,
KeysetsResponse,
Expand Down Expand Up @@ -340,24 +338,7 @@ async def check_state(
) -> PostCheckStateResponse:
"""Check whether a secret has been spent already or not."""
logger.trace(f"> POST /v1/checkstate: {payload}")

# BEGIN BACKWARDS COMPATIBILITY < 0.15.1
# If the request includes "secret", compuate Ys from them and continue request
if payload.secrets:
payload.Ys = [
b_dhke.hash_to_curve(s.encode()).serialize().hex() for s in payload.secrets
]
# END BACKWARDS COMPATIBILITY < 0.15.1

proof_states = await ledger.check_proofs_state(payload.Ys)

# BEGIN BACKWARDS COMPATIBILITY < 0.15.1
# If the request includes "secret", remove add the secret to the response
if payload.secrets:
for i, state in enumerate(proof_states):
state.secret = payload.secrets[i]
# END BACKWARDS COMPATIBILITY < 0.15.1

return PostCheckStateResponse(states=proof_states)


Expand Down

0 comments on commit 30ee04a

Please sign in to comment.