mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-20 18:44:20 +01:00
wallet: add batch size setting (#431)
This commit is contained in:
@@ -139,6 +139,7 @@ class WalletSettings(CashuSettings):
|
|||||||
)
|
)
|
||||||
|
|
||||||
locktime_delta_seconds: int = Field(default=86400) # 1 day
|
locktime_delta_seconds: int = Field(default=86400) # 1 day
|
||||||
|
proofs_batch_size: int = Field(default=1000)
|
||||||
|
|
||||||
|
|
||||||
class LndRestFundingSource(MintSettings):
|
class LndRestFundingSource(MintSettings):
|
||||||
|
|||||||
@@ -576,8 +576,11 @@ async def burn(ctx: Context, token: str, all: bool, force: bool, delete: str):
|
|||||||
if delete:
|
if delete:
|
||||||
await wallet.invalidate(proofs)
|
await wallet.invalidate(proofs)
|
||||||
else:
|
else:
|
||||||
# batch check proofs
|
# invalidate proofs in batches
|
||||||
for _proofs in [proofs[i : i + 100] for i in range(0, len(proofs), 100)]:
|
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)
|
await wallet.invalidate(_proofs, check_spendable=True)
|
||||||
print_balance(ctx)
|
print_balance(ctx)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user