Skip to content

Commit

Permalink
refactor spending conditions and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Oct 21, 2023
1 parent 0490f20 commit aa91964
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 177 deletions.
5 changes: 4 additions & 1 deletion cashu/core/p2pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def from_secret(cls, secret: Secret):
return cls(**secret.dict(exclude={"tags"}), tags=secret.tags)

def get_p2pk_pubkey_from_secret(self) -> List[str]:
"""Gets the P2PK pubkey from a Secret depending on the locktime
"""Gets the P2PK pubkey from a Secret depending on the locktime.
If locktime is passed, only the refund pubkeys are returned.
Else, the pubkeys in the data field and in the 'pubkeys' tag are returned.
Args:
secret (Secret): P2PK Secret in ecash token
Expand Down
3 changes: 2 additions & 1 deletion cashu/core/secret.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from loguru import logger
Expand All @@ -7,7 +8,7 @@
from .crypto.secp import PrivateKey


class SecretKind:
class SecretKind(Enum):
P2PK = "P2PK"
HTLC = "HTLC"

Expand Down
Loading

0 comments on commit aa91964

Please sign in to comment.