Skip to content

Commit

Permalink
make format
Browse files Browse the repository at this point in the history
  • Loading branch information
lollerfirst committed Sep 16, 2024
1 parent d561dbe commit e35df9b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
16 changes: 7 additions & 9 deletions cashu/mint/db/write.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List, Optional, Tuple, Union, Dict
import json
from typing import Dict, List, Optional, Tuple, Union

from loguru import logger

Expand All @@ -7,16 +8,16 @@
DlcBadInput,
DlcFundingAck,
DlcFundingError,
DlcPayout,
DlcPayoutForm,
DlcSettlement,
DlcSettlementAck,
DlcSettlementError,
DlcPayoutForm,
DlcPayout,
MeltQuote,
MeltQuoteState,
MintKeyset,
MintQuote,
MintQuoteState,
MintKeyset,
Proof,
ProofSpentState,
ProofState,
Expand All @@ -26,18 +27,15 @@
from ...core.errors import (
CashuError,
DlcAlreadyRegisteredError,
DlcPayoutFail,
DlcSettlementFail,
TokenAlreadySpentError,
TransactionError,
DlcSettlementFail,
DlcNotFoundError,
DlcPayoutFail,
)
from ..crud import LedgerCrud
from ..events.events import LedgerEventManager
from .read import DbReadHelper

import json


class DbWriteHelper:
db: Database
Expand Down
2 changes: 0 additions & 2 deletions cashu/mint/dlc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Dict
import json

from ..core.base import DlcSettlement
from ..core.errors import TransactionError
from ..core.nuts import DLC_NUT
from .features import LedgerFeatures
Expand Down
9 changes: 4 additions & 5 deletions cashu/mint/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
DlcFundingAck,
DlcFundingError,
DlcFundingProof,
DlcSettlement,
DlcSettlementError,
DlcPayout,
DlcPayoutForm,
DlcSettlement,
DlcSettlementError,
MeltQuote,
MeltQuoteState,
Method,
Expand Down Expand Up @@ -49,20 +49,19 @@
NotAllowedError,
QuoteNotPaidError,
TransactionError,
DlcPayoutFail,
)
from ..core.helpers import sum_proofs
from ..core.models import (
GetDlcStatusResponse,
PostDlcPayoutRequest,
PostDlcPayoutResponse,
PostDlcRegistrationRequest,
PostDlcRegistrationResponse,
PostDlcSettleRequest,
PostDlcSettleResponse,
PostMeltQuoteRequest,
PostMeltQuoteResponse,
PostMintQuoteRequest,
PostDlcPayoutRequest,
PostDlcPayoutResponse,
)
from ..core.settings import settings
from ..core.split import amount_split
Expand Down
4 changes: 2 additions & 2 deletions cashu/mint/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
MintInfoContact,
PostCheckStateRequest,
PostCheckStateResponse,
PostDlcPayoutRequest,
PostDlcPayoutResponse,
PostDlcRegistrationRequest,
PostDlcRegistrationResponse,
PostDlcSettleRequest,
Expand All @@ -30,8 +32,6 @@
PostRestoreResponse,
PostSwapRequest,
PostSwapResponse,
PostDlcPayoutRequest,
PostDlcPayoutResponse,
)
from ..core.settings import settings
from ..mint.startup import ledger
Expand Down
8 changes: 6 additions & 2 deletions cashu/mint/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@
Unit,
)
from ..core.crypto import b_dhke
from ..core.crypto.dlc import merkle_verify, verify_payout_secret, verify_payout_signature
from ..core.crypto.dlc import (
merkle_verify,
verify_payout_secret,
verify_payout_signature,
)
from ..core.crypto.secp import PrivateKey, PublicKey
from ..core.db import Connection, Database
from ..core.errors import (
CashuError,
DlcPayoutFail,
DlcSettlementFail,
DlcVerificationFail,
NoSecretInProofsError,
NotAllowedError,
SecretTooLongError,
TransactionError,
TransactionUnitError,
DlcPayoutFail,
)
from ..core.settings import settings
from ..lightning.base import LightningBackend
Expand Down
8 changes: 4 additions & 4 deletions tests/test_dlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from cashu.core.base import (
DiscreetLogContract,
DlcOutcome,
DlcSettlement,
DlcPayoutForm,
DlcPayoutWitness,
DlcSettlement,
Proof,
SCTWitness,
TokenV4,
Expand All @@ -31,9 +31,9 @@
)
from cashu.core.errors import CashuError
from cashu.core.models import (
PostDlcPayoutRequest,
PostDlcRegistrationRequest,
PostDlcSettleRequest,
PostDlcPayoutRequest,
)
from cashu.core.secret import Secret, SecretKind
from cashu.mint.ledger import Ledger
Expand Down Expand Up @@ -645,7 +645,7 @@ async def test_payout_dlc(wallet: Wallet, ledger: Ledger):

# CLAIMING our victorious payout
# Generating outputs
amounts = [64,32,16,8,4,2,1]
amounts = [128]
secrets, rs, _ = await wallet.generate_n_secrets(
len(amounts), skip_bump=True
)
Expand All @@ -664,6 +664,6 @@ async def test_payout_dlc(wallet: Wallet, ledger: Ledger):
response = await ledger.payout_dlc(request)

assert response.errors is None, f"Payout failed: {response.errors[0].detail}"
assert len(response.paid) > 0, f"Payout failed: paid list is empty"
assert len(response.paid) > 0, "Payout failed: paid list is empty"
assert response.paid[0].dlc_root == dlc_root.hex()
assert len(response.paid[0].outputs) == len(amounts)

0 comments on commit e35df9b

Please sign in to comment.