cashu-feni
cashu-feni copied to clipboard
outputs constructed when doing split can tell mint the intended payment amount vs change
When sending from wallet, the way outputs are constructed in the request for /split
they could be telling the mint which is the intended payment amount vs which is the change.
Code in wallet constructing output
total := SumProofs(proofs)
frstAmt := total - amount
scndAmt := amount
frstOutputs := mint.AmountSplit(frstAmt)
scndOutputs := mint.AmountSplit(scndAmt)
amounts := append(frstOutputs, scndOutputs...)
So if user has a balance of 100 and tries a send 20
the output amounts when requesting a split to the mint could look like [16, 64, 4, 16]
Describe the solution you'd like Maybe sort the outputs slice before sending request to mint.