Skip to content

Commit

Permalink
wallet: add batch size setting
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Feb 16, 2024
1 parent 1397c46 commit f638ed4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions cashu/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class WalletSettings(CashuSettings):
)

locktime_delta_seconds: int = Field(default=86400) # 1 day
proofs_batch_size: int = Field(default=1000)


class LndRestFundingSource(MintSettings):
Expand Down
7 changes: 5 additions & 2 deletions cashu/wallet/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,11 @@ async def burn(ctx: Context, token: str, all: bool, force: bool, delete: str):
if delete:
await wallet.invalidate(proofs)
else:
# batch check proofs
for _proofs in [proofs[i : i + 100] for i in range(0, len(proofs), 100)]:
# invalidate proofs in batches
for _proofs in [
proofs[i : i + settings.proofs_batch_size]
for i in range(0, len(proofs), settings.proofs_batch_size)
]:
await wallet.invalidate(_proofs, check_spendable=True)
print_balance(ctx)

Expand Down

0 comments on commit f638ed4

Please sign in to comment.