Skip to content

Commit

Permalink
do not split if not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Dec 2, 2023
1 parent f1d3842 commit 580c588
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions tests/test_mint_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,14 @@ async def test_melt_internal(ledger: Ledger, wallet: Wallet):
assert wallet.balance == 64

# create invoice to melt to
# use 2 sat less because we need to pay the fee
invoice = await wallet.request_mint(62)
invoice = await wallet.request_mint(64)
invoice_payment_request = invoice.bolt11

quote = await wallet.melt_quote(invoice_payment_request)
keep, send = await wallet.split_to_send(wallet.proofs, 62)
inputs_payload = [p.to_dict() for p in send]
assert quote.amount == 64
assert quote.fee_reserve == 0

inputs_payload = [p.to_dict() for p in wallet.proofs]

assert quote.amount == 62
assert quote.fee_reserve == 0
Expand Down
8 changes: 5 additions & 3 deletions tests/test_mint_api_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ async def test_melt_internal(ledger: Ledger, wallet: Wallet):

invoice_payment_request = invoice.bolt11

await wallet.melt_quote(invoice_payment_request)
quote = await wallet.melt_quote(invoice_payment_request)
assert quote.amount == 64
assert quote.fee_reserve == 0

inputs_payload = [p.to_dict() for p in wallet.proofs]

# outputs for change
Expand Down Expand Up @@ -199,8 +202,7 @@ async def test_melt_external(ledger: Ledger, wallet: Wallet):
assert quote.amount == 62
assert quote.fee_reserve == 2

keep, send = await wallet.split_to_send(wallet.proofs, 62)
inputs_payload = [p.to_dict() for p in send]
inputs_payload = [p.to_dict() for p in wallet.proofs]

# outputs for change
secrets, rs, derivation_paths = await wallet.generate_n_secrets(1)
Expand Down

0 comments on commit 580c588

Please sign in to comment.